I am using ofxJsonRPC and have a question. I get my response from clients (based on the example through this line of code:
ofLogVerbose("ofApp::setText") << args.params.dump(4);
It dumps the JSON file as a string. However it contains / that I guess are used to escape the " but it is a string.
so I get this:
If I try to parse args.params, or args.results I don’t get any data, however the string dump shows I have the data coming back.
How can I either convert a string, already correctly formatted like this:
Or better yet how can I parse the data that returns from ofxJSONRPC with ofJson?
args.params is an ofJson object … and an ofJson object is just a
So you can just use all of the normal accessors that are included with
std::cout << args.params["userid"] << std::endl;
should print the userid …
OR … perhaps ofxJSONRPC is not parsing the string as JSON but just saving it as a single string in ofJson?
You can test it out by running code like above. If you can’t get individual values, the json probably isn’t getting parsed correctly in ofxJSONRPC and we should check on that …
Hi, I guess my first idea was correct, there is something amis with the formatting. It seems the escape characters are not handled correctly in Json file that I get on the OF side, and it has a \ before every "
Treating it as a Json file does not work as it is valid (by coincidence) but not useable.