Skip to content

JsonParser.getValueAsString() should return field name for JsonToken.FIELD_NAME, not null #188

@cowtowncoder

Description

@cowtowncoder

(note: offshoot of FasterXML/jackson-databind#745)

Although Javadocs do not specify expected behavior for JsonParser.getValueAsString(), when current token is JsonToken.FIELD_NAME, it makes more sense to return name as-is, instead of null.
This will simplify handling of code that requires a String representation; and code that does need to know the difference can use token type if that is relevant.

While this can be seen as a fix it is still a minor API change, so it needs to go in 2.6.0, not a 2.5.x patch release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions