JSONiq - The JSON Query Language. SpahQL - A query language for Javascript objects. Javascript doesn’t make dealing with structured data easy at all. Even when you’re working with data you control, you’re having to put filthy, nasty null checks and do-while descent loops everywhere. When the data is out of your control, such as data pulled from some external JSON(P) API, the problem can become more severe. To scratch my own itch in this regard, I’ve created SpahQL, a query language and data manipulation library for dealing with Javascript objects.
To use it, all you need do is ask SpahQL to create a database wrapping your object: Now you have access to an xpath-like syntax for accessing data: var foos = db.select("//foo"); return foos.values(); //-> ["bar-a", "bar-b"] And also making assertions about data: db.assert("/a/foo == /b/foo"); //-> true db.assert("/a/foo == //moo"); //-> false A jQuery-like syntax for modifying your data: Below is a REPL which you can use to have a play. JaqlOverview - jaql - Jaql: A JSON Query Language - Query Language for JavaScript(r) Object Notation (JSON) In this document, we introduce Jaql, a query language for JavaScript Object Notation or JSON. Although Jaql has been designed specifically for JSON, we have tried to borrow some of the best features of SQL, XQuery, LISP, and PigLatin. Our high-level design objectives include: Semi-structured analytics: easy manipulation and analysis of JSON data Parallelism: Jaql queries that process large amounts of data must be able to take advantage of scaled-out architectures Extensibility: users must be able to easily extend Jaql We begin with an example of JSON data, then go on to several examples using the data to illustrate key features of Jaql and show how it can be used to process JSON data in parallel using Hadoop's map/reduce framework.
Along the way, we will refer to Jaql's core operators, builtin functions and show how Jaql's function and IO libraries can be extended. Note: Jaql is still in early development, so beware that it is likely to change over the next few months.