Overview
Features
Download
Documentation
Community
Add-Ons & Services

JSONConfiguration in 1.5.2

Please post support and help requests here.

JSONConfiguration in 1.5.2

Postby vikascoder » 26 Feb 2014, 20:24

Hi,
Is it a known problem that it is impossible to replace an item in a JSON Array (e.g. in a .json file) using Poco/Util/JSONConfiguration API? It only appends to the array.
Example:
Code: Select all
// sample json file
{
  "config" : {
    "some_array_values" : [
      0,
      1,
      2
    ],
    "prop1" : "changed"
}

// Access syntax via JSONConfiguration
AutoPtr<JSONConfiguration> jsonConf( new JSONConfiguration(json_config_path) );
int number_test = jsonConf->getInt("config.some_array_values[1]");  // Returns 1

// Replace this value with a new one
jsonConf->setInt("config.some_array_values[1]", 99);  // Doesn't replaces, simply appends the value to the end of the array??


Is this supposed to work at all with this syntax in the present and future builds? Internally the JSON Array interface only has an add function which appends values.
vikascoder
 
Posts: 2
Joined: 26 Feb 2014, 20:15

Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests