Skip to content

Commit 946274d

Browse files
authored
Fixed rendering error on $..book[?(@.price <= $['expensive'])] in README.md (#967)
Add code blocks and fix error that says Misplaced @ because of two dollar signs ($) in a JsonPath expression in Path Examples section for `$..book[?(@.price <= $['expensive'])]`
1 parent 425bcb1 commit 946274d

File tree

1 file changed

+46
-45
lines changed

1 file changed

+46
-45
lines changed

Diff for: README.md

+46-45
Original file line numberDiff line numberDiff line change
@@ -85,41 +85,42 @@ Functions
8585
Functions can be invoked at the tail end of a path - the input to a function is the output of the path expression.
8686
The function output is dictated by the function itself.
8787

88-
| Function | Description | Output type |
89-
|:----------|:-------------------------------------------------------------------------------------|:---------------------|
90-
| min() | Provides the min value of an array of numbers | Double |
91-
| max() | Provides the max value of an array of numbers | Double |
92-
| avg() | Provides the average value of an array of numbers | Double |
93-
| stddev() | Provides the standard deviation value of an array of numbers | Double |
94-
| length() | Provides the length of an array | Integer |
95-
| sum() | Provides the sum value of an array of numbers | Double |
96-
| keys() | Provides the property keys (An alternative for terminal tilde `~`) | `Set<E>` |
97-
| concat(X) | Provides a concatinated version of the path output with a new item | like input |
98-
| append(X) | add an item to the json path output array | like input |
99-
| first() | Provides the first item of an array | Depends on the array |
100-
| last() | Provides the last item of an array | Depends on the array |
101-
| index(X) | Provides the item of an array of index: X, if the X is negative, take from backwards | Depends on the array |
88+
| Function | Description | Output type |
89+
|:------------|:-------------------------------------------------------------------------------------|:---------------------|
90+
| `min()` | Provides the min value of an array of numbers | Double |
91+
| `max()` | Provides the max value of an array of numbers | Double |
92+
| `avg()` | Provides the average value of an array of numbers | Double |
93+
| `stddev()` | Provides the standard deviation value of an array of numbers | Double |
94+
| `length()` | Provides the length of an array | Integer |
95+
| `sum()` | Provides the sum value of an array of numbers | Double |
96+
| `keys()` | Provides the property keys (An alternative for terminal tilde `~`) | `Set<E>` |
97+
| `concat(X)` | Provides a concatinated version of the path output with a new item | like input |
98+
| `append(X)` | add an item to the json path output array | like input |
99+
| `first()` | Provides the first item of an array | Depends on the array |
100+
| `last()` | Provides the last item of an array | Depends on the array |
101+
| `index(X)` | Provides the item of an array of index: X, if the X is negative, take from backwards | Depends on the array |
102+
102103
Filter Operators
103104
-----------------
104105

105106
Filters are logical expressions used to filter arrays. A typical filter would be `[?(@.age > 18)]` where `@` represents the current item being processed. More complex filters can be created with logical operators `&&` and `||`. String literals must be enclosed by single or double quotes (`[?(@.color == 'blue')]` or `[?(@.color == "blue")]`).
106107

107108
| Operator | Description |
108109
| :----------------------- | :-------------------------------------------------------------------- |
109-
| == | left is equal to right (note that 1 is not equal to '1') |
110-
| != | left is not equal to right |
111-
| < | left is less than right |
112-
| <= | left is less or equal to right |
113-
| > | left is greater than right |
114-
| >= | left is greater than or equal to right |
115-
| =~ | left matches regular expression [?(@.name =~ /foo.*?/i)] |
116-
| in | left exists in right [?(@.size in ['S', 'M'])] |
117-
| nin | left does not exists in right |
118-
| subsetof | left is a subset of right [?(@.sizes subsetof ['S', 'M', 'L'])] |
119-
| anyof | left has an intersection with right [?(@.sizes anyof ['M', 'L'])] |
120-
| noneof | left has no intersection with right [?(@.sizes noneof ['M', 'L'])] |
121-
| size | size of left (array or string) should match right |
122-
| empty | left (array or string) should be empty |
110+
| `==` | left is equal to right (note that 1 is not equal to '1') |
111+
| `!=` | left is not equal to right |
112+
| `<` | left is less than right |
113+
| `<=` | left is less or equal to right |
114+
| `>` | left is greater than right |
115+
| `>=` | left is greater than or equal to right |
116+
| `=~` | left matches regular expression [?(@.name =~ /foo.*?/i)] |
117+
| `in` | left exists in right [?(@.size in ['S', 'M'])] |
118+
| `nin` | left does not exists in right |
119+
| `subsetof` | left is a subset of right [?(@.sizes subsetof ['S', 'M', 'L'])] |
120+
| `anyof` | left has an intersection with right [?(@.sizes anyof ['M', 'L'])] |
121+
| `noneof` | left has no intersection with right [?(@.sizes noneof ['M', 'L'])] |
122+
| `size` | size of left (array or string) should match right |
123+
| `empty` | left (array or string) should be empty |
123124

124125

125126
Path Examples
@@ -169,23 +170,23 @@ Given the json
169170

170171
| JsonPath | Result |
171172
|:-------------------------------------------------------------------| :----- |
172-
| $.store.book[*].author | The authors of all books |
173-
| $..author | All authors |
174-
| $.store.* | All things, both books and bicycles |
175-
| $.store..price | The price of everything |
176-
| $..book[2] | The third book |
177-
| $..book[-2] | The second to last book |
178-
| $..book[0,1] | The first two books |
179-
| $..book[:2] | All books from index 0 (inclusive) until index 2 (exclusive) |
180-
| $..book[1:2] | All books from index 1 (inclusive) until index 2 (exclusive) |
181-
| $..book[-2:] | Last two books |
182-
| $..book[2:] | All books from index 2 (inclusive) to last |
183-
| $..book[?(@.isbn)] | All books with an ISBN number |
184-
| $.store.book[?(@.price < 10)] | All books in store cheaper than 10 |
185-
| $..book[?(@.price <= $['expensive'])] | All books in store that are not "expensive" |
186-
| $..book[?(@.author =~ /.*REES/i)] | All books matching regex (ignore case) |
187-
| $..* | Give me every thing
188-
| $..book.length() | The number of books |
173+
| `$.store.book[*].author` | The authors of all books |
174+
| `$..author` | All authors |
175+
| `$.store.*` | All things, both books and bicycles |
176+
| `$.store..price` | The price of everything |
177+
| `$..book[2]` | The third book |
178+
| `$..book[-2]` | The second to last book |
179+
| `$..book[0,1]` | The first two books |
180+
| `$..book[:2]` | All books from index 0 (inclusive) until index 2 (exclusive) |
181+
| `$..book[1:2]` | All books from index 1 (inclusive) until index 2 (exclusive) |
182+
| `$..book[-2:]` | Last two books |
183+
| `$..book[2:]` | All books from index 2 (inclusive) to last |
184+
| `$..book[?(@.isbn)]` | All books with an ISBN number |
185+
| `$.store.book[?(@.price < 10)]` | All books in store cheaper than 10 |
186+
| `$..book[?(@.price <= $['expensive'])]` | All books in store that are not "expensive" |
187+
| `$..book[?(@.author =~ /.*REES/i)]` | All books matching regex (ignore case) |
188+
| `$..*` | Give me every thing
189+
| `$..book.length()` | The number of books |
189190

190191
Reading a Document
191192
------------------

0 commit comments

Comments
 (0)