JsonPath
JSONPath equips JSON documents with parsing capabilities, allowing you to conveniently locate nodes and extract desired data. It serves as the JSON equivalent of XPath.
How to write JSONPath?
| JsonPath | Example |
|---|---|
| $ | Root element of the document |
| - | - |
| @ | Current element |
.or [] | Child element operator |
| .. | Recursive descent, matches all child elements |
| * | Wildcard, matches all child elements |
| [] | Subscript operator, retrieves elements by index.JSONPath indices start at 0 |
| ` | [,] |
| [start:end :step] | Data slice operation (not supported in XPath) |
| ?() | Filter expression |
| () | Script expression, uses the underlying scripting engine |
Example
