Skip to content

Parser don't throw exception when specific JSON is not valid #3400

@honzap

Description

@honzap

Describe the bug
When trying to parse invalid JSON, the parser doesn't throw ParseException but parse the JSON.
JSON:

{}something

Simple test:

public class JsonParseTest {

    @Test
    void testParsingJson()  {
        ObjectMapper objectMapper = new ObjectMapper();

        assertThrows(JsonParseException.class, () -> objectMapper.readTree("{}something"));
    }
}

Version information
2.13.1

To Reproduce
Just run the parsing (readTree or readValue) with incorrect JSON input as shown.

Expected behavior
Parser throws JsonParseException

Additional context

Attached simple test project:
jackson-parse-error.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    will-not-fixClosed as either non-issue or something not planned to be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions