Skip to content

Partial parse issue if the JSON string ends with an open bracket { or a comma , #297

@SuperPat45

Description

@SuperPat45

Testing the new ACCEPT_INCOMPLETE parse mode and found an issue when the JSON string ends with an open bracket { or a comma ,

JSONParser p = new JSONParser( JSONParser.MODE_PERMISSIVE | JSONParser.ACCEPT_INCOMPLETE );
System.out.println( JSONObject.toJSONString( (JSONObject) p.parse("{") ) );
System.out.println( JSONObject.toJSONString( (JSONObject) p.parse("{\"test\":\"test\",") ) );

create an item child with empty key and null value:

{"":null}
{"test":"test","":null}

instead of:

{}
{"test":"test"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions