Search code examples
javajsonxpathjsonpath

Java based JSON manipulations


Is anyone aware of a JSON-XPath style library that allows data manipulation; update, delete, create, etc...

JsonPath.write(json, "$.store.book[*].author", value);

I've looked into the following, but none allow altering the content.

JPath

JSONQuery

JSONiJ


Solution

  • JsonPath (im using 2.2.0) now allows the manipulation of JSON data. e.g.

        String jsonData = "{\"drink\":\"juice\"}";
        JsonPath.parse(jsonData).set("$.drink", "beer").jsonString();
    

    results in {"drink":"beer"}