It's a beginner question, how would I format the following json array of strings into std::string
[
{
"x" : 12.1,
"y" : 12.1,
"z" : 12.1
},
{
"x" : 12.1,
"y" : 12.1,
"z" : 12.1
},
{
"x" : 12.1,
"y" : 12.1,
"z" : 12.1
},
{
"x" : 12.1,
"y" : 12.1,
"z" : 12.1
}
]
Here is the json string
const std::string json =
"[\n"
" {\n"
" \"x\" : 0,\n"
" \"y\" : 0,\n"
" \"z\" : 0\n"
" },\n"
" {\n"
" \"x\" : 640,\n"
" \"y\" : 0,\n"
" \"z\" : 0\n"
" },\n"
" {\n"
" \"x\" : 640,\n"
" \"y\" : 0,\n"
" \"z\" : 480\n"
" },\n"
" {\n"
" \"x\" : 0,\n"
" \"y\" : 0,\n"
" \"z\" : 480\n"
" }\n"
"]\n";
Json::Value coordinates;
Json::Reader reader;
reader.parse( json, coordinates );
So I'm trying to parse the above json array, to get a list of coordinates, but it can't be parsed correctly.