Skip to content

Parser fails on 'single quoted' keys #182

Closed
@cyb3rc

Description

@cyb3rc

Trying to parse objects with single quoted keys:

Json::CharReaderBuilder builder;
builder.settings_["allowDroppedNullPlaceholders"] = true;
std::auto_ptr<Json::CharReader> reader(builder.newCharReader());

Json::StreamWriterBuilder writer;

Json::Value root;
std::string rawJson = "{'key': \"qwerty:123456\", 'isError':  false }";
std::string errors;

if (reader->parse(rawJson.c_str(), rawJson.c_str() + rawJson.length(), &root, &errors))
{
    std::cout << Json::writeString(writer, root) << std::endl;
}
else
{
    std::cout << errors << std::endl;
}

Getting an error:

  • Line 1, Column 2 Missing '}' or object member name

Also, is it possible to add support of unquoted keys?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions