You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been trying to implement this solution and I have been getting the same error:
terminate called after throwing an instance of 'nlohmann::detail::parse_error'
what(): [json.exception.parse_error.101] parse error at 97: syntax error - unexpected '}'; expected string literal
My code:
auto s = create_json_config(); // return content from file jsonstr.txt
cout<<s;
json uuid;
uuid.parse(s);
if (uuid.is_object())
{
auto obj = uuid.get<json::object_t>();
for (auto& kvp : obj)
{
std::cout << kvp.first << ":" << kvp.second << "\n";
}
}
@pboettch is right, and the error message hints at this: after the comma, an object key (i.e., a string literal) is expected. You can verify that jsonstr.txt is invalid by using, e.g., https://jsonlint.com.
I've been trying to implement this solution and I have been getting the same error:
My code:
jsonstr.txt
The text was updated successfully, but these errors were encountered: