How to get some pretty printing in a string #3324
Answered
by
nlohmann
beemibrahim
asked this question in
Q&A
-
I want to dump json contents into a string , then print it with pretty printing |
Beta Was this translation helpful? Give feedback.
Answered by
nlohmann
Feb 9, 2022
Replies: 3 comments 1 reply
Answer selected by
beemibrahim
-
Also "dump()" returns a C++ string where the entries are in alphabetical order, i want them to be in normal order |
Beta Was this translation helpful? Give feedback.
1 reply
-
nlohmann::json js = nlohmann::json::parse(model_desc);
std::string pretty_s = js.dump(4);
std::cout << pretty_s << std::endl; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://json.nlohmann.me/api/basic_json/dump/