@Test
public void test() {
String createJson = "{}";
DocumentContext createContext = JsonPath.parse(createJson).set("$.id", 1);
System.out.println(createContext.jsonString());
String updateJson = "{id: 1}";
DocumentContext updateContext = JsonPath.parse(updateJson).set("$.id", 2);
System.out.println(updateContext.jsonString());
}
Is there a way to perform the addition? e.g. set the id if not present.
Is there a way to perform the addition? e.g. set the id if not present.