Skip to content

Allow to use non strict parsing #2063

Closed
@mlutken

Description

Currently, when parsing json from the "wild-web" there might be small problems like for example an ';' appended after an otherwise correct json. Being able to create a parser that flips the internal strict mode to false would be a great help when parsing these kinds of json sources.

The
"static basic_json parse" function around line 6608 in json.hpp calls the internal parser with a "hardcoded" 'true' for the strict mode parameter.
If we could somehow make it possible to instantiate a json parser which uses false here, that would be really useful.

The function looks like this:

    JSON_HEDLEY_WARN_UNUSED_RESULT
    static basic_json parse(detail::input_adapter&& i,
                            const parser_callback_t cb = nullptr,
                            const bool allow_exceptions = true)
    {
        basic_json result;
        parser(i, cb, allow_exceptions).parse(true, result);
        return result;
    }

It's the parser(i, cb, allow_exceptions).parse(true, result); I would like to be able to be:

parser(i, cb, allow_exceptions).parse(false, result);

Regards Martin

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions