Here's the corrected version:
BTW, a more efficient way to deal with strings is to use the platform-native string type, utility::string_t. This is std::wstring on Windows and std::string on Linux. The only complication is string literals, for which we have a macro to give the platform-native result. This allows you to avoid unnecessary runtime conversions of strings:
std::string MY_JSON = "{ \"username\": \"xyz\", \"password\": \"abc\" }";
json::value x = json::value::parse(utility::conversions::to_string_t(MY_JSON));
for (auto iter = x.cbegin(); iter != x.cend(); ++iter)
{
const json::value &key = iter->first;
const json::value &value = iter->second;
// Manipulating key and value
}
Note: parse() is a static function, so its intended use is as a factory, not a manipulator.BTW, a more efficient way to deal with strings is to use the platform-native string type, utility::string_t. This is std::wstring on Windows and std::string on Linux. The only complication is string literals, for which we have a macro to give the platform-native result. This allows you to avoid unnecessary runtime conversions of strings:
utility::string_t MY_JSON = U("{ \"username\": \"xyz\", \"password\": \"abc\" }");
json::value x = json::value::parse(MY_JSON);
for (auto iter = x.cbegin(); iter != x.cend(); ++iter)
{
const json::value &key = iter->first;
const json::value &value = iter->second;
// Manipulating key and value
}