JsonIterator
This library allows you to iterate over Json from a string or an array.
Uses JsonPath to identify which nodes should be iterated upon.
JSONPath Examples
JSONPath
Result
$.store.books[\*].author
the authors of all books in the store
$..author
all authors
$.store..price
the price of everything in the store.
$..books[2]
the third book
$..books[(@.length-1)]
the last book in order.
$..books[0,1]
the first two books
$..books[:2]
the first two books
$..books[?(@.isbn)]
filter all books with isbn number
$..books[?(@.price<10)]
filter all books cheapier than 10
$..*
all elements in the data (recursively extracted)
Expression syntax
Symbol
Description
$
The root object/element (not strictly necessary)
@
The current object/element
.
or []
Child operator
..
Recursive descent
*
Wildcard. All child elements regardless their index.
[,]
Array indices as a set
[start:end:step]
Array slice operator borrowed from ES4/Python.
?()
Filters a result set by a script expression
()
Uses the result of a script expression as the index