JSON and a JSONPath are both strings that I have. I want to use the JSON path to query the JSON and obtain the returned JSON as a string.
I believe the industry standard is Jayway's json-path. However, there isn't much of a connection between the web API and the library you actually download from Maven. However, the version in GrepCode is basically equivalent.
I feel like I should be able to:
String originalJson; //these are initialized to actual data
String queriedJson = JsonPath.<String>read(originalJson, jsonPath);
My code throws an exception for some queries because read returns whatever it deems acceptable based on what the JSONPath really discovers (e.g., a ListObject>, String, double, etc.). This is an issue. It would seem logical to believe that there would be a mechanism to query JSON and return JSON; do you have any ideas?