We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I wrote the JSON to a file like this,
ofstream file("foo.json"); file << foo->serialize() << endl;
(serialize() returns nholmann::json)
serialize()
nholmann::json
and the file ended up looking like,
"[[{\"x\":27,\"y\":0},{\"x\":27,\"y\":1}],[{\"x\":27,\"y\":0}, ....
I think it gets serialized twice and ends up writing a string. But if I pipe serialize() to std::cout the console output is formatted properly.
std::cout
I would want it to look like
[[{"x":27,"y":0},{"x":27,"y":1}],[{"x":27,"y":0},
How can I achieve this?
The text was updated successfully, but these errors were encountered:
That looks odd. Can you make sure serialize() returns a json?
json
Sorry, something went wrong.
Whoops, I had put .dump() in that function but it compiled because string can be casted to json I guess...
.dump()
Thanks.
That explains the double escaping. :)
No branches or pull requests
I wrote the JSON to a file like this,
(
serialize()
returnsnholmann::json
)and the file ended up looking like,
I think it gets serialized twice and ends up writing a string. But if I pipe
serialize()
tostd::cout
the console output is formatted properly.I would want it to look like
How can I achieve this?
The text was updated successfully, but these errors were encountered: