Skip to content

Allow valueToTree() via SerializationContext, add to ObjectWriter #2411

@XakepSDK

Description

@XakepSDK

Currently i have this serializer code:

if(value.hasStyling()) {
    JsonNode jsonNode = JacksonComponentSerializer.MAPPER.valueToTree(value.style());
    if (jsonNode.isObject()) {
        Iterator<Map.Entry<String, JsonNode>> fields = jsonNode.fields();
        while (fields.hasNext()) {
            Map.Entry<String, JsonNode> next = fields.next();
            gen.writeFieldName(next.getKey());
            gen.writeTree(next.getValue());
        }
    }
}

Can we have some way to convert object to TreeNode without static access to mapper?

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.xIssues to be only tackled for Jackson 3.x, not 2.xmost-wantedTag to indicate that there is heavy user +1'ing action

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions