Skip to content

Strict mode parses invalid json. #72

@ya1gaurav

Description

@ya1gaurav

[]An error has occurred.

Jsoncpp strict mode is able to parse above input.
This is invalid json but somehow passed by latest jsoncpp code till "]". It is not considering input after "]".

Sample code :

int main()
{
Json::Value root;

ifdef STRICT
Json::Reader reader(Json::Features::strictMode());

else
Json::Reader reader;

endif
std::ifstream file("test_now.json");

bool parsingSuccessful = reader.parse(file, root);

if(!parsingSuccessful)
{
        cout << "Failed to parse configuration. " << reader.getFormatedErrorMessages();
        return 0;
}
else
        cout << "Pretty-Print: " << root.toStyledString() << endl;

}

Output with all & strict mode:
./all
Pretty-Print: []

./strict
Pretty-Print: []

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions