AJSON

AJSON provides a fast and simple way to search a JSON document.

Examples

name.last        >> "Anderson"
age              >> 37
children         >> ["Sara","Alex","Jack"]
children.#       >> 3
children.1       >> "Alex"
child*.2         >> "Jack"
c?ildren.0       >> "Sara"
fav\.movie       >> "Deer Hunter"
friends.#.first  >> ["Dale","Roger","Jane"]
friends.1.last   >> "Craig"

Query an array for the first match by using #(...), or find all matches with #(...)#. Queries support the ==, !=, <, <=,>, >= comparison operators and the simple pattern matching % operator.

friends.#(last=="Murphy").first   >> "Dale"
friends.#(last=="Murphy")#.first  >> ["Dale","Jane"]
friends.#(age>45)#.last           >> ["Craig","Murphy"]
friends.#(first%"D*").last        >> "Murphy"
friends.#(nets.#(=="fb"))#.first  >> ["Dale","Roger"]

Use the selectors syntax to join multiple paths into a new JSON document.

{name.first,age,"murphys":friends.#(last="Murphy")#.first}
[name.first,age,children.0]

Powered by webassembly