JSON array does not display all values if they are same value (jsoncpp used)

Viewed 34

If I codded as

Json::Value root, arr;
arr.append(0);
arr.append(0);
arr.append(0);
root["array"] = arr;

The output was like as..

{
  "array" : [ 0, 0 ]
}

The problem is that only two values are shown. I'd like to make it "array" : [ 0, 0, 0 ] even though they are all same.

For reference, in case they are different, the output would be well-printed.

Json::Value root, arr;
arr.append(0);
arr.append(1);
arr.append(2);
root["array"] = arr;

->

{
  "array" : [ 0, 1, 2 ]
}

Is there any optimized logic to print same values in an array by jsoncpp library? And is there any solution how to print all values?

1 Answers

I resolved this, it's not an issue because just console output has a omitted string. If I make a file(ofstream) from the json string, all values are printed well.

Related