1
- Python JSONPath RW
2
- ==================
1
+ Python JSONPath Next-Generation
2
+ ===============================
3
3
4
- https://github.com/kennknowles/python-jsonpath-rw
5
-
6
- |Build Status | |Test coverage | |PyPi version | |PyPi downloads |
4
+ A final implementation of JSONPath for Python, including arithmetic
5
+ and binary comparison operators, as defined in the original `JSONPath proposal `_.
7
6
8
7
This library provides a robust and significantly extended implementation
9
- of JSONPath for Python. It is tested with Python 2.6, 2.7, 3.2, 3.3.
10
- *(On travis-ci there is a segfault when running the tests with pypy; I don't think the problem lies with this library) *.
8
+ of JSONPath for Python. It is tested with Python 2.6, 2.7, 3.2, 3.3.
11
9
12
10
This library differs from other JSONPath implementations in that it is a
13
11
full *language * implementation, meaning the JSONPath expressions are
14
12
first class objects, easy to analyze, transform, parse, print, and
15
- extend. (You can also execute them :-)
13
+ extend.
16
14
17
15
Quick Start
18
16
-----------
@@ -21,15 +19,15 @@ To install, use pip:
21
19
22
20
::
23
21
24
- $ pip install git+git://github.com/tomas-fp/python-jsonpath-rw .git#egg=jsonpath-rw
22
+ $ pip install git+git://github.com/tomas-fp/python-jsonpath-ng .git#egg=jsonpath-ng
25
23
26
24
Then:
27
25
28
26
.. code :: python
29
27
30
28
$ python
31
29
32
- >> > from jsonpath_rw import jsonpath, parse
30
+ >> > from jsonpath_ng import jsonpath, parse
33
31
34
32
# A robust parser, not just a regex. (Makes powerful extensions possible; see below)
35
33
>> > jsonpath_expr = parse(' foo[*].baz' )
@@ -51,12 +49,13 @@ Then:
51
49
>> > [match.value for match in parse(' a.*.b.`parent`.c' ).find({' a' : {' x' : {' b' : 1 , ' c' : ' number one' }, ' y' : {' b' : 2 , ' c' : ' number two' }}})]
52
50
[' number two' , ' number one' ]
53
51
54
- # You can also build expressions directly quite easily
55
- >> > from jsonpath_rw .jsonpath import Fields
56
- >> > from jsonpath_rw .jsonpath import Slice
52
+ # You can also build expressions directly quite easily
53
+ >> > from jsonpath_ng .jsonpath import Fields
54
+ >> > from jsonpath_ng .jsonpath import Slice
57
55
58
56
>> > jsonpath_expr_direct = Fields(' foo' ).child(Slice(' *' )).child(Fields(' baz' )) # This is equivalent
59
57
58
+
60
59
JSONPath Syntax
61
60
---------------
62
61
@@ -151,7 +150,7 @@ Extensions
151
150
- *Path data *: The result of ``JsonPath.find `` provide detailed context
152
151
and path data so it is easy to traverse to parent objects, print full
153
152
paths to pieces of data, and generate automatic ids.
154
- - *Automatic Ids *: If you set ``jsonpath_rw .auto_id_field `` to a value
153
+ - *Automatic Ids *: If you set ``jsonpath_ng .auto_id_field `` to a value
155
154
other than None, then for any piece of data missing that field, it
156
155
will be replaced by the JSONPath to it, giving automatic unique ids
157
156
to any piece of data. These ids will take into account any ids
@@ -164,7 +163,7 @@ Extensions
164
163
More to explore
165
164
---------------
166
165
167
- There are way too many jsonpath implementations out there to discuss.
166
+ There are way too many JSONPath implementations out there to discuss.
168
167
Some are robust, some are toy projects that still work fine, some are
169
168
exercises. There will undoubtedly be many more. This one is made for use
170
169
in released, maintained code, and in particular for programmatic access
@@ -205,13 +204,13 @@ This package is authored and maintained by:
205
204
206
205
- `Kenn Knowles <https://github.com/kennknowles >`__
207
206
(`@kennknowles <https://twitter.com/KennKnowles >`__)
208
-
209
- with the help of patches submitted by `these contributors <https://github.com/kennknowles/python-jsonpath-rw /graphs/contributors >`__.
207
+
208
+ with the help of patches submitted by `these contributors <https://github.com/kennknowles/python-jsonpath-ng /graphs/contributors >`__.
210
209
211
210
Copyright and License
212
211
---------------------
213
212
214
- Copyright 2013- Kenneth Knowles
213
+ Copyright 2013 - Kenneth Knowles
215
214
216
215
Licensed under the Apache License, Version 2.0 (the "License"); you may
217
216
not use this file except in compliance with the License. You may obtain
@@ -227,11 +226,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
227
226
See the License for the specific language governing permissions and
228
227
limitations under the License.
229
228
230
- .. |Build Status | image :: https://travis-ci.org/kennknowles/python-jsonpath-rw.png?branch=master
231
- :target: https://travis-ci.org/kennknowles/python-jsonpath-rw
232
- .. |Test coverage | image :: https://coveralls.io/repos/kennknowles/python-jsonpath-rw/badge.png?branch=master
233
- :target: https://coveralls.io/r/kennknowles/python-jsonpath-rw
234
- .. |PyPi version | image :: https://pypip.in/v/jsonpath-rw/badge.png
235
- :target: https://pypi.python.org/pypi/jsonpath-rw
236
- .. |PyPi downloads | image :: https://pypip.in/d/jsonpath-rw/badge.png
237
- :target: https://pypi.python.org/pypi/jsonpath-rw
229
+ .. _`JSONPath proposal` : http://goessner.net/articles/JsonPath/
230
+ .. |Build Status | image :: https://travis-ci.org/kennknowles/python-jsonpath-ng.png?branch=master
231
+ :target: https://travis-ci.org/kennknowles/python-jsonpath-ng
232
+ .. |Test coverage | image :: https://coveralls.io/repos/kennknowles/python-jsonpath-ng/badge.png?branch=master
233
+ :target: https://coveralls.io/r/kennknowles/python-jsonpath-ng
234
+ .. |PyPi version | image :: https://pypip.in/v/jsonpath-ng/badge.png
235
+ :target: https://pypi.python.org/pypi/jsonpath-ng
236
+ .. |PyPi downloads | image :: https://pypip.in/d/jsonpath-ng/badge.png
237
+ :target: https://pypi.python.org/pypi/jsonpath-ng
0 commit comments