Hello
I am getting a SyntaxExcetion when trying to address an array in my json configuration file.
The config:
{
"config" :
{ "prop1" : "value1",
"prop2" : 10,
"prop3" : ["element1", "element2" ],
"prop4" : {
"prop5" : false,
"prop6" : null
}
}
}
My code:
Poco::AutoPtr<Poco::Util::JSONConfiguration> cfg = new Poco::Util::JSONConfiguration("config.json");
std::string arrProperty = cfg->getString("config.prop3[1]");
I think the best illustration is a screenshot form my debugger immediately before the exception is thrown:
We're trying to get the string "config.prop3[1]".
We have already looped through the "config" token, and are now handling "prop3[1]".
When running NumberParser::parse() on the "num" variable value "prop3[1]" we get the exception.
I think the error is with the matches. num is created from matches[1], but matches only contain 1 entry! matches[1] is thus not valid!
Normally we would expect the global match on index 0, and the group match on index 1. If that were the case there would be no error!
Regards
Klaus
Hello
I am getting a SyntaxExcetion when trying to address an array in my json configuration file.
The config:
My code:
I think the best illustration is a screenshot form my debugger immediately before the exception is thrown:
We're trying to get the string "config.prop3[1]".
We have already looped through the "config" token, and are now handling "prop3[1]".
When running NumberParser::parse() on the "num" variable value "prop3[1]" we get the exception.
I think the error is with the matches. num is created from matches[1], but matches only contain 1 entry! matches[1] is thus not valid!
Normally we would expect the global match on index 0, and the group match on index 1. If that were the case there would be no error!
Regards
Klaus