You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,16 @@ This is a [JSONPath](http://goessner.net/articles/JsonPath/) implementation for
10
10
11
11
This implementation features all elements in the specification except the `()` operator (in the spcecification there is the `$..a[(@.length-1)]`, but this can be achieved with `$..a[-1]` and the latter is simpler).
12
12
13
-
On top of this it implements some extended features:
14
-
* Regex match key (p.e. `$.*[?(/^bo{2}k$/)]` or `$[?(/a\wthors/)]`).
15
-
* Regex match value comparisons (p.e. `$.store.book[?(@.author =~ /.*Tolkien/)]`)
16
-
* For the child operator `[]` there is no need to surround child names with quotes (p.e. `$.[store][book, bicycle]`) except if the name of the field is a non-valid javascript variable name.
17
-
*`.length` can be used to get the length of a string, get the length of an array and to check if a node has children.
13
+
In case of no matches for the query it will return an empty array.
18
14
19
15
Features
20
16
========
21
17
This implementation has the following features:
18
+
* Regex match key (p.e. `$.*[?(/^bo{2}k$/)]` or `$[?(/a\wthors/)]`).
19
+
* Regex match value comparisons (p.e. `$.store.book[?(@.author =~ /.*Tolkien/)]`)
20
+
* For the child operator `[]` there is no need to surround child names with quotes (p.e. `$[store][book, bicycle]`) except if the name of the field is a non-valid javascript variable name.
21
+
*`.length` can be used to get the length of a string, get the length of an array and to check if a node has children.
22
+
* The `in` operator allows filtering for a value in a specified list: `$..[?(@.author in ["Nigel Rees", "Evelyn Waugh", $.store.book[3].author])]`
22
23
* Object oriented implementation.
23
24
*__Get__, __set__ and __add__ operations.
24
25
* Magic methods implemented:
@@ -82,7 +83,8 @@ When creating a new instance of JsonObject, you can pass a second parameter to t
82
83
This sets the behaviour of the instance to use SmartGet.
83
84
84
85
What SmartGet does is to determine if the given JsonPath branches at some point, if it does it behaves as usual;
85
-
otherwise, it will directly return the value pointed by the given path (not the array containing it).
86
+
otherwise, it will directly return the value pointed by the given path (not the
87
+
array containing it) or `false` if not found.
86
88
87
89
GetJsonObjects
88
90
--------------
@@ -134,7 +136,7 @@ dashes (`-`).
134
136
135
137
### Limitations on the specification:
136
138
* The jsonpath inside _value_ cannot contain `or`, `and` or any comparator.
137
-
* Jsonpaths in _value_ return the first element of the set or false if no result.
139
+
* Jsonpaths in _value_ return the first element of the set or `false` if no result.
138
140
* Boolean operations can't be grouped with parethesis.
139
141
*`and`s are run before `or`s. That means that `a and 1 = b or c != d` is the same
0 commit comments