Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no such path in target JSON document #126

Open
roshbrahm opened this issue Apr 20, 2022 · 0 comments
Open

no such path in target JSON document #126

roshbrahm opened this issue Apr 20, 2022 · 0 comments

Comments

@roshbrahm
Copy link

roshbrahm commented Apr 20, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant