Skip to content

ObjectMapper.valueToTree does not work with @JsonRawValue #348

@pimlottc

Description

@pimlottc

The handy valueToTree shortcut method on ObjectMapper does not appear to support pojos with the @JsonRawValue annotation:

java.lang.IllegalArgumentException: Called operation not supported for TokenBuffer

Looking at the TokenBuffer implementation of JsonGenerator used internally for this operation, I find that all the writeRaw methods are unimplemented.

This annotation works as expected in a full round-trip conversion (pojo->JSON->JsonNode). The valueToTree method is described as "Functionally same" so I would expect it to support this annotation (and all others) as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions