<< Click to Display Table of Contents >> Navigation: JSON > JSONPath |
JSONPath allows to select nodes from JSON tree using combination of paths and conditions.
There are two methods in THtJSONNode that accepts JSONPath expressions:
function Find(const APath: hstring): IHtJSONIterator - returns node enumerator
function FindValue(const APath: string): PHtJSON - returns first found node.
Library supports standard JSONPath syntax https://www.rfc-editor.org/rfc/rfc9535 with the following extensions:
Starting $. can be omitted.
@. can be omitted in conditions.
? can be omitted in conditions
aggregate functions sum(), max(), min(), avg(), first(), last(), list(), count() can be used at the end of expression
additional supported operators:
*= contains substring
^= starting with
$= ending with
Example of JSONPath expressions:
result.* - all elements in result array of root object
result[delivered = true] - all result child elements with delivered = true