I want to make an array with libJSON's JSONNode
. I've tried the following, but it doesn't work:
JSONNode array;
JSONNode foo("word", "foo");
JSONNode bar("word", "bar");
array.push_back(foo);
array.push_back(bar);
This results in:
{
"word": "foo",
"word": "bar"
}
What I want is:
[
{"word": "foo"},
{"word": "bar"}
]
It's clear to me that I'm not specifying that I want an array. The thing is, I've searched the library and googled a bit, but I find no way to do this. Can anybody help me out with this?
(Sidenote: I wanted to add a "libjson" tag, but that doesn't exist yet, it seems.)