#Python #NoSQL #Javascript #JSON #nested-array-object
ObjectPath is a query language similar to XPath or JSONPath, but much more powerful thanks to embedded arithmetic calculations, comparison mechanisms and built-in functions. This makes the language more like SQL in terms of expressiveness, but it works over JSON documents rather than relations. ObjectPath can be considered a full-featured expression language. Besides selector mechanism there is also boolean logic, type system and string concatenation available. On top of that, the language implementations (Python at the moment; Javascript is in beta!) are secure and relatively fast.
This is a maintained fork of the original project and still compatible with the specification at the ObjectPath site. New ideas and features are welcome, however changes that break compatibility with the spec will be rejected.
ObjectPath makes it easy to find data in big nested JSON documents. It borrows the best parts from E4X, JSONPath, XPath and SQL. ObjectPath is to JSON documents what XPath is to XML. Other examples to ilustrate this kind of relationship are:
Scope | Language |
---|---|
text documents | regular expression |
XML | XPath |
HTML | CSS selectors |
JSON documents | ObjectPath |
$ pip install objectpath-ng
$ objectpath file.json
or
$ git clone https://github.com/objectpath/ObjectPath.git
$ cd ObjectPath
$ python shell.py file.json
$ pip install objectpath-ng
$ python
>>> from objectpath import *
>>> tree=Tree({"a":1})
>>> tree.execute("$.a")
1
>>>
$ git clone https://github.com/objectpath/ObjectPath.git
$ cd ObjectPath
$ python
>>> from objectpath import *
>>> tree=Tree({"a":1})
>>> tree.execute("$.a")
1
>>>
Pull requests welcome!
MIT