Replies: 1 comment 2 replies
-
std::string myString = "myNewString"; to std::string myString = "\"myNewString\""; |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Has stated.
This work perfectly:
std::string myInteger = "45";
json jInteger= json::parse(myInteger );
if(jInteger.is_number()){ std::cout << "¿Is it number?: Yes = " << jInteger<< std::endl;}
Output: ¿Is it number?: Yes = 45
But this wont work:
std::string myString = "myNewString";
json jString= json::parse(myString );
if(jString.is_string()){ std::cout << "¿Is it string?: Yes = " << jString<< std::endl;}
Output:
terminate called after throwing an instance of 'nlohmann::json_abi_v3_11_3::detail::parse_error'
what(): [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - invalid literal; last read: 'm'
Beta Was this translation helpful? Give feedback.
All reactions