Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix output #1550

Closed
pianonyy opened this issue Mar 27, 2019 · 4 comments
Closed

Matrix output #1550

pianonyy opened this issue Mar 27, 2019 · 4 comments

Comments

@pianonyy
Copy link

Hello, nlohmann. How can I add matrix type to json file?
So, I did this :
Снимок экрана от 2019-03-27 11-31-24
Снимок экрана от 2019-03-27 11-25-53
And it doesn't work, it just prints this report:
Снимок экрана от 2019-03-27 11-29-55

@nlohmann
Copy link
Owner

@nlohmann
Copy link
Owner

I cannot reproduce the error. The following program

#include "json.hpp"
#include <iostream>

using json = nlohmann::json;

int main(int argc, char *argv[])
{
    constexpr std::size_t TASK_count = 3;
    int intensity_between_TASK[TASK_count][TASK_count] = {{1,2,3}, {4,5,6}, {7,8,9}};
    json j;
    j["intensity_between_TASK"] = intensity_between_TASK;
    
    std::cout << j << std::endl;
}

works with output

{"intensity_between_TASK":[[1,2,3],[4,5,6],[7,8,9]]}

@nlohmann
Copy link
Owner

nlohmann commented Apr 5, 2019

@AntonPolevoi Do you need further assistance on this issue?

@pianonyy
Copy link
Author

pianonyy commented Apr 7, 2019 via email

@nlohmann nlohmann closed this as completed Apr 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants