-
-
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
cannot parse from string? #1349
Comments
For printf("j=%s \n", str.c_str()); In general, the mixture between the class and C-style code may need additional casting. Could you try: printf("happy=%d, pi=%f \n", j["happy"].get<bool>(), j["pi"].get<double>()); Or just use |
@nlohmann Thank you so much! I'm really appreciated! and also got these two tip: it seems the value part must be the strict type match as ".get" told, when I use it to communicate to a java server which using gson or fastjson or from the web client, there would be quoted numbers. Is there any features to switch on for these situations? |
The library does not perform implicit conversions such as from string to numbers. |
got it. |
here is my code:
this is build:
g++ -Wall -std=c++14 -I./json/include -L./json/lib test4.cpp -o t4
and result:
./t4
j=
happy=25431392, pi=0.000000
The text was updated successfully, but these errors were encountered: