-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
how to get the json object again from which printed by the method of dump() #792
Comments
You don't need the |
I found that the when there are some Chinese characters in json data, the parse function can't work. |
We extensively tested the |
from dump string |
Which exception do you get? |
I used "std::list c_list" to combine the string fields and used json ss(c_list) to create the ss json object, then run dump() method. as you can see the above results. |
Which exception do you get? The exception gives hint where the parse error occurs. |
what kind of exception you want to catch? it just jump into the catch(...) block.. |
Just surround the |
parse error - unexpected '"' |
This is really strange. Could you please try without the |
Actually, I didn't use c_str(). |
What does |
how to check the version? I get the json.hpp at version 2.1.1 on 06/18/2017 |
Could you try this file: https://github.com/nlohmann/json/blob/develop/src/json.hpp Is the resulting string UTF-8 encoded? |
I am not sure, maybe is not encoded by UTF-8. I will check this after. |
Assuming std::string s = "\"";
s += W2A(strHP);
s += "\"";
json::parse(s); |
It does the UTF-8 encoding cause this problem:) THX ^_^ |
Thanks for checking back! |
string wormhole;
wormhole = jsonPayload.dump();
How can I convert std::string to json object again?
When I use 'auto x = json::parse(wormhole.c_str()) ', the exception was occurred.
The text was updated successfully, but these errors were encountered: