I know that write StringValue and IntegerValue.
"account" : "javawork",
"serial" : 10
writeValue["account"] = std::string("javawork");
writeValue["serial"] = 10;
but How do I write ArrayValue?
By Any chance did u get this working. I am stuck with the same problem. Any help would be great.
Some one might be interested.
_bstr_t sss = _T("");
if(jReader.parse((char *)(sss), jValueRoot))
widgetMem["name"] = 'name';
Json::Value::UInt ii = jValueRoot.size();
jValueRoot[ii] = widgetMem;
std::string output = writer.write( jValueRoot );
I struggled a lot to do dis, but its actually quite easy :-)
i had a momentary pause on this point too, but it's actually trivial.
use ".append" on the node you want to add an array to.
Json::Value friend_node = root["friends"];
makes it nice & easy to add arrays via looping, etc. you can also create 2D arrays (eg: arrays of arrays) easily in the same way, by looping appends onto the first/second/third/etc element in the array you just created.
I know it's an old thread, but shouldn't be it:
root["friends"] = friend_node;
Json::Value& friend_node = root["friends"];
Thanks Paulik , your solution got me working.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.