-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
create json instance from raw json (unsigned char*) #431
Comments
Can anyone help me? |
You need to have an |
What can I do if the http client I am using returns the response body as a "basic_ostream"? |
That seems to be an odd thing for it to return. What client are you using? |
it was made by a friend, I was reading wrong, it actually returns "unsigned char*" and not "basic_ostream", my apologies. but it doesnt work still, how can I create a nlohmann::json instance from json (not Serialized) returned from a server? |
|
that gives "Segmentation fault" |
Where is the segmentation fault (stack trace)? It could be a problem with the string itself. Do you get the same fault if you use |
@CheyenneForbes As @gregmarr said, the parse function can handle |
@CheyenneForbes Any update? |
Hey, sorry for the delayed response, the client was actually sending a POST request instead of a GET request so the json instance was actually "empty bytes" when I was trying to add/get data, I thought the issue was with the json instance because when I opened the link in the browser it worked. I recommend that anyone using the json header file and plan to receive the json data from "outside" should do so in a try{}catch(){} block when application crashes due to "empty" data arent "acceptable", for example when being used in a web server |
Thanks for the quick response! |
I cant get nor set values if I try :
basic_ostream BOS = get_json_from_server(); // the json response from a server json BOS_json = BOS;
If I am doing something wrong, whats the right way to create a json instance from raw json received from a webserver as basic_ostream?
The text was updated successfully, but these errors were encountered: