I am using Jsoncpp to parse json-formats for c++. I do not understand how it works though; there is a lack of documentation and examples to get me started, and I was wondering if anyone could give me some quick pointers. The only examples I've found deals with files...
I'm using a HTTP stack to get a json-message in a buffer. For example, a buffer contains the message {"state":"Running"}. How do I use the Json::reader to parse this? Again the only example I've found deals with reading from files
How do you write values to a Json-message? For example I want to write "monkey : no" and "running : yes" to a Json-message which I can then use in my GET request.
Thanks
UPDATE:
on 1), for example, how to parse a buffer containing a json-message like this:
char* buff;
uint32_t buff_size;
Maybe this is good sample for first part of your question:
Json::Value values;
Json::Reader reader;
reader.parse(input, values);
Json::Value s = values.get("state","default value");
There is anything but lack of documentation. Yes, it's mainly reference documentation, but it's quite good and well cross-linked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With