jQuery is not required. This example uses it simply to pull in an external json file.
The pretty dump is compliments of Net Grow and as well is not required.
Usage and Syntax Notes
Only Select statements are supported
The requested fields may be a "*" or a list of fields. "*" is likely faster in most cases.
When typing lists "select field1,field2,field3" or "limit 5,10 do not use spaces.
When using the "where" clause enclose all conditions with one set of parenthesis "where (category=='The Category' || category=='Other Category')".
The where clause is a javascript condition, not sql. It should use the scope emplied by "from". Javascript functions may be used here as well as javascript operators.
The from clause should establish the scope you would like returned. It should start with "json" and use the dot notation: "json.channel.items" and should point to an array within the object.
The order by option can accept a list but will only order by the first field at this time(asc,desc,ascnum,descnum).
SQL Example
select title,url from json.channel.items where (category=='bla' || category=='bla bla') order by title desc limit 5,10
Complete Call
jsonsql.query("select * from json.channel.items order by title desc",json);
jsonsql.query("select title,url from json.channel.items where (category=='javascript' || category=='vista') order by title,category asc limit 3",json);
This library definitely is not the fastest parsing solution compared to xpath for xml, however simplicity at times may out weigh the need for speed.