0

Creating a JSON object using jsoncpp and have error when added in array as follows.

Json::Value zone1;
Json::Value coord;
zone1["zoneID"] = "shop1";
zone1["stamp"] = "xxxxx";
zone1["gridSizeX"] = "50";
zone1["gridSizeY"] = "20";
zone1["gridScale"] = "0.5";
zone1["gridOrigin"] = {"28.5", "12.6"};

This line zone1["gridOrigin"] = {"28.5", "12.6"}; has the following error.

has terminate called after throwing an instance of 'Json::LogicError'
  what():  in Json::Value::duplicateAndPrefixStringValue(): length too big for prefixing

How can I modify?

batuman
  • 7,066
  • 26
  • 107
  • 229

1 Answers1

1

I have updated as the followings and it works.

Json::Value zone1;
Json::Value coord;
Json::Value gridOrigin;
zone1["zoneID"] = "shop1";
zone1["stamp"] = "xxxxx";
zone1["gridSizeX"] = "50";
zone1["gridSizeY"] = "20";
zone1["gridScale"] = "0.5";
gridOrigin.append("28.5"); gridOrigin.append("12.6");
zone1["gridOrigin"] = gridOrigin;
     
batuman
  • 7,066
  • 26
  • 107
  • 229