Skip to content

no such path in target JSON document #126

Open
@roshbrahm

Description

@roshbrahm

we are using 'com.github.fge:json-patch:1.9'

List<JsonPatchOperation> patchOperations = new ArrayList<>();
patchOperations.add(new ReplaceOperation(JsonPointer.of("/firstName"),new TextNode("rosh")));
patchOperations.add(new ReplaceOperation(JsonPointer.of("/lastName"),new TextNode("brahm")));
patchOperations.add(new ReplaceOperation(JsonPointer.of("/addresses/0/city"),new TextNode("my city")));


JsonNode patched = patch.apply(objectMapper.convertValue(target, JsonNode.class));

the patch operations have been evaluated to

[op: replace; path: "/~1firstName"; value: "rosh", op: replace; path: "/~1lastName"; value: "brahm",op: replace; path: "/addresses~10~1city"; value: "my city"]

then com.github.fge.jsonpatch.JsonPatchException: no such path in target JSON document has been thrown
how do we resolve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions