0

I am comparing two json document and is using mapdifference to get the difference of the two. Now i want to patch this difference to an existing json, but the difference returned is in the form

/applicant/0/EmployDetail/0/AnnualSalary: 99999868.99
/Notes/0/customNote: OM Application Notes

and so on.

Used the following to generate the difference:

MapDifference<String, Object> difference = Maps.difference(leftFlatMap, rightFlatMap);
difference.entriesOnlyOnRight().forEach((key, value) -> System.out.println(key + ": " + value));

I am expecting it to convert it to a jsonnode.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
anji
  • 1
  • Possible duplicate of [How to convert HashMap to JsonNode with Jackson?](https://stackoverflow.com/questions/39391095/how-to-convert-hashmap-to-jsonnode-with-jackson) – MikeFHay Jul 09 '19 at 11:04

1 Answers1

0
JsonNode jsonDifference = new ObjectMapper().valueToTree(difference.entriesOnlyOnRight());
Zoe
  • 27,060
  • 21
  • 118
  • 148
MikeFHay
  • 8,562
  • 4
  • 31
  • 52