@@ -187,30 +187,43 @@ Extras
187187Extensions
188188----------
189189
190- +--------------+----------------------------------------------+
191- | name | Example |
192- +==============+==============================================+
193- | len | - $.objects.`len` |
194- +--------------+----------------------------------------------+
195- | sub | - $.field.`sub(/foo\\\\ +(.*)/, \\\\ 1)` |
196- +--------------+----------------------------------------------+
197- | split | - $.field.`split(+, 2, -1)` |
198- | | - $.field.`split(sep, segement, maxsplit)` |
199- +--------------+----------------------------------------------+
200- | sorted | - $.objects.`sorted` |
201- | | - $.objects[\\ some_field] |
202- | | - $.objects[\\ some_field,/other_field] |
203- +--------------+----------------------------------------------+
204- | filter | - $.objects[?(@some_field > 5)] |
205- | | - $.objects[?some_field = "foobar")] |
206- | | - $.objects[?some_field =~ "foobar")] |
207- | | - $.objects[?some_field > 5 & other < 2)] |
208- +--------------+----------------------------------------------+
209- | arithmetic | - $.foo + "_" + $.bar |
210- | (-+*/) | - $.foo * 12 |
211- | | - $.objects[*].cow + $.objects[*].cat |
212- +--------------+----------------------------------------------+
213-
190+ To use the extensions below you must import from `jsonpath_ng.ext `.
191+
192+ +--------------+-----------------------------------------------+
193+ | name | Example |
194+ +==============+===============================================+
195+ | len | - ``$.objects.`len` `` |
196+ +--------------+-----------------------------------------------+
197+ | sub | - ``$.field.`sub(/foo\\\\+(.*)/, \\\\1)` `` |
198+ | | - ``$.field.`sub(/regex/, replacement)` `` |
199+ +--------------+-----------------------------------------------+
200+ | split | - ``$.field.`split(+, 2, -1)` `` |
201+ | | - ``$.field.`split(sep, segement, maxsplit)```|
202+ +--------------+-----------------------------------------------+
203+ | sorted | - ``$.objects.`sorted` `` |
204+ | | - ``$.objects[\\some_field] `` |
205+ | | - ``$.objects[\\some_field,/other_field] `` |
206+ +--------------+-----------------------------------------------+
207+ | filter | - ``$.objects[?(@some_field > 5)] `` |
208+ | | - ``$.objects[?some_field = "foobar"] `` |
209+ | | - ``$.objects[?some_field =~ "foobar"] `` |
210+ | | - ``$.objects[?some_field > 5 & other < 2] `` |
211+ | | |
212+ | | Supported operators: |
213+ | | - Equality: ==, =, != |
214+ | | - Comparison: >, >=, <, <= |
215+ | | - Regex match: =~ |
216+ | | |
217+ | | Combine multiple criteria with '&'. |
218+ | | |
219+ | | Properties can only be compared to static |
220+ | | values. |
221+ +--------------+-----------------------------------------------+
222+ | arithmetic | - ``$.foo + "_" + $.bar `` |
223+ | (-+*/) | - ``$.foo * 12 `` |
224+ | | - ``$.objects[*].cow + $.objects[*].cat `` |
225+ +--------------+-----------------------------------------------+
226+ -
214227About arithmetic and string
215228---------------------------
216229
@@ -228,10 +241,10 @@ Example with data::
228241 'fish': 'bar'
229242 }
230243
231- | ** cow + fish** returns ** cowfish**
232- | ** $.cow + $.fish** returns ** foobar**
233- | ** $.cow + "_" + $.fish** returns ** foo_bar**
234- | ** $.cow + "_" + fish** returns ** foo_fish**
244+ | `` cow + fish`` returns `` cowfish``
245+ | `` $.cow + $.fish`` returns `` foobar``
246+ | `` $.cow + "_" + $.fish`` returns `` foo_bar``
247+ | `` $.cow + "_" + fish`` returns `` foo_fish``
235248
236249About arithmetic and list
237250-------------------------
@@ -245,7 +258,7 @@ Example with data::
245258 {'cow': 4, 'cat': 6}
246259 ]}
247260
248- | ** $.objects[\*].cow + $.objects[\*].cat** returns ** [6, 9]**
261+ | `` $.objects[\*].cow + $.objects[\*].cat`` returns `` [6, 9]``
249262
250263More to explore
251264---------------
@@ -322,9 +335,7 @@ limitations under the License.
322335
323336.. |PyPi downloads | image :: https://pypip.in/d/jsonpath-ng/badge.png
324337 :target: https://pypi.python.org/pypi/jsonpath-ng
325- .. |Build Status | image :: https://travis-ci.org /h2non/jsonpath-ng. svg?branch=master
326- :target: https://travis-ci.org /h2non/jsonpath-ng
338+ .. |Build Status | image :: https://github.com /h2non/jsonpath-ng/actions/workflows/ci.yml/badge. svg
339+ :target: https://github.com /h2non/jsonpath-ng/actions/workflows/ci.yml
327340.. |PyPI | image :: https://img.shields.io/pypi/v/jsonpath-ng.svg?maxAge=2592000?style=flat-square
328341 :target: https://pypi.python.org/pypi/jsonpath-ng
329- .. |Documentation Status | image :: https://img.shields.io/badge/docs-latest-green.svg?style=flat
330- :target: http://jsonpath-ng.readthedocs.io/en/latest/?badge=latest
0 commit comments