JsonPath offers a query notation for JSON documents.The following example and reference are copied from the Github project this library is based on: https://github.com/json-path/JsonPath
Some JSON is coming from sources that serialize polymorphic class structures, which are not handled by the built-in jsonToClass() primitive. In these cases, there is no way to get the class presentations of these JSON data structures. However, often you can identify the parts of the structure that are unambiguous, and would like to feed these parts to jsonToClass().
The below class diagram shows all available functionality:
There is one polymorphic operation that allows evaluation of a JsonPath expression against a document. One version expects the document as a JSON String, the other as a reference to a previously cached document (see Json Document Cache).
JsonPath Examples
Json Path Reference
Online Evaluator
You should test your JsonPath expressions first, e.g. using this online JsonPath evaluator: https://jsonpath.herokuapp.com, which uses the same underlying Java code.
Definite vs Indefinite JsonPath queries
When working with JsonPath expressions, it is important to know what kind of result to expect. Queries can be definite or indefinite. Definite queries will return a structured element (starting with '{'), or an array (starting with '[') when the query identifies an array. Indefinite queries will always return an array, even if contains only one element. Please see the GitHub page of the underlying Java code for an introduction to JsonPath expression.
Related Content
Related Pages:
-
JsonDiff
Calculate JSON patch from two JSONdocuments, or apply a patch to a document. -
JsonMatch
Testing JSON strings or object instances for matching against a DSL (Domain Specific Language) similar toWHEREclauses in SQL. -
JsonNode
Parse and manipulate arbitrary JSON strings, without the need to create a class representation for it. -
JsonPointer
Extract part of JSON object using a JsonPointer (such as returned as part of a patch from JsonDiff). -
Json Schema
Convert a JSON schema file to an XSD, ready to be imported into the PAS Builder. -
https://scheer-pas-doc.atlassian.net/wiki/x/koGRJQ
Generate SQL statements from JSON objects.
Related Documentation:
-
-
jsonToClass()
Maps a JSON string to an object.
-