How can I get a json out of a value_type? #4005
-
Hi, I am trying to convert a int intVal{123456};
nlohmann::json::value_type intValT{intVal};
nlohmann::json intJson {intValT};
ASSERT_STREQ(to_string(intVal).data(), intJson.dump().data()); But it does not, not even the following code: int intVal{123456};
nlohmann::json::value_type intValT{intVal};
nlohmann::json intJson = nlohmann::json::parse(intValT.dump());
ASSERT_STREQ(to_string(intVal).data(), intJson.dump().data()); The first throw:
And the second throw:
How can I convert the raw value from I really appreciate any help you can provide |
Beta Was this translation helpful? Give feedback.
Answered by
nmkoremblum
Apr 11, 2023
Replies: 1 comment
-
Ok, this can be solved by doing: int intVal{123456};
nlohmann::json::value_type intValT = intVal;
nlohmann::json intJson = intValT;
ASSERT_STREQ(to_string(intVal).data(), intJson.dump().data()); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
nmkoremblum
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, this can be solved by doing: