Skip to content

Bug: can't create array more than 5 items #252

Closed
@gzliudan

Description

@gzliudan

test code is:

    int count = 5;
    Json::Value root;
    Json::Value item;
    root["array"] = Json::Value::nullRef;
    for (int i = 0; i < count; i++)
    {
        item["a"] = i;
        item["b"] = i;
        root["array"][i] = item;
    }

the above code's result is wrong,

{
   "array" : [
      {
         "a" : 0,
         "b" : 0
      }
   ]
}

but if when the count = 4, then the result is right:

{
   "array" : [
      {
         "a" : 0,
         "b" : 0
      },
      {
         "a" : 1,
         "b" : 1
      },
      {
         "a" : 2,
         "b" : 2
      },
      {
         "a" : 3,
         "b" : 3
      }
   ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions