no such path in target JSON document
Opened this issue · 0 comments
roshbrahm commented
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?