Skip to content

Deprecated JsonNode.with(String) suggests using JsonNode.withObject(String) but it is not the same thingΒ #3780

@bmatasar

Description

@bmatasar

Is your feature request related to a problem? Please describe.
Version 2.14 deprecated JsonNode.with(String) and suggests replacing it with JsonNode.withObject(String). However, this causes problems because JsonNode.withObject(String) accepts only expressions, whereas the former method accepts a property. Moreover, JsonNode.withArray(String) accepts both property names and expressions, making it quite asymmetric.

Describe the solution you'd like
Migrating the method would imply in many cases extra work and prepending the "/" before every property name in existing calls.
From the deprecation message of JsonNode.with(String) I would change myObj.with(myProp) to myObj.withObject(myProp) but that throws an exception, so I have to do myObj.withObject("/" + myProp), which I find unpleasant. Again, myObj.withArray(myProp) works just fine without need of change.

Usage example
The change from myObj.with(myProp) to myObj.withObject(myProp) should work with property or expression.

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