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
+67-51Lines changed: 67 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,20 +37,35 @@ that ```$.shop.orders[?(@.active)].id``` and get the result ``` [1,4] ```
37
37
38
38
### The jsonpath description
39
39
40
+
#### Functions
41
+
42
+
##### Size
43
+
A function `size()` transforms the output of the filtered expression into a size of this element
44
+
45
+
| Json element | function size |
46
+
|--------------|--------------------------|
47
+
| null | 0 |
48
+
| numbers | 1 |
49
+
| string | a length of given string |
50
+
| array | a length of given array |
51
+
| objects | a length of set of keys |
52
+
53
+
`$.some_field.size()`
54
+
40
55
#### Operators
41
56
42
-
| Operator | Description | Where to use |
43
-
|---|---|---|
44
-
| `$` | Pointer to the root of the json. | It is gently advising to start every jsonpath from the root. Also, inside the filters to point out that the path is starting from the root.
45
-
| `@` | Pointer to the current element inside the filter operations. | It is used inside the filter operations to iterate the collection.
46
-
| `*` or `[*]` | Wildcard. It brings to the list all objects and elements regardless their names. | It is analogue a flatmap operation.
47
-
| `<..>`| Descent operation. It brings to the list all objects, children of that objects and etc | It is analogue a flatmap operation.
48
-
| `.<name>` or `.['<name>']` | the key pointing to the field of the object | It is used to obtain the specific field.
49
-
| `['<name>' (, '<name>')]` | the list of keys | the same usage as for a single key but for list
50
-
|`[<number>]`| the filter getting the element by its index. |
51
-
|`[<number> (, <number>)]`| the list if elements of array according to their indexes representing these numbers. |
52
-
| `[<start>:<end>:<step>]` | slice operator to get a list of element operating with their indexes. By default step = 1, start = 0, end = array len. The elements can be omitted ```[:]```
53
-
| `[?(<expression>)]` | the logical expression to filter elements in the list. | It is used with arrays preliminary.
|`$`| Pointer to the root of the json. | It is gently advising to start every jsonpath from the root. Also, inside the filters to point out that the path is starting from the root.|
60
+
|`@`| Pointer to the current element inside the filter operations. | It is used inside the filter operations to iterate the collection.|
61
+
|`*` or `[*]`| Wildcard. It brings to the list all objects and elements regardless their names. | It is analogue a flatmap operation.|
62
+
|`<..>`| Descent operation. It brings to the list all objects, children of that objects and etc | It is analogue a flatmap operation.|
63
+
|`.<name>` or `.['<name>']`| the key pointing to the field of the object | It is used to obtain the specific field.|
64
+
|`['<name>' (, '<name>')]`| the list of keys | the same usage as for a single key but for list|
65
+
|`[<number>]`| the filter getting the element by its index.||
66
+
|`[<number> (, <number>)]`| the list if elements of array according to their indexes representing these numbers.||
67
+
|`[<start>:<end>:<step>]`| slice operator to get a list of element operating with their indexes. By default step = 1, start = 0, end = array len. The elements can be omitted ```[:]```||
68
+
|`[?(<expression>)]`| the logical expression to filter elements in the list. | It is used with arrays preliminary.|
54
69
55
70
#### Filter expressions
56
71
@@ -61,22 +76,21 @@ following elements:
61
76
string value `'value'`, array of them or another json path instance.
62
77
- Expression sign, denoting what action can be performed
63
78
64
-
| Expression sign | Description | Where to use |
65
-
| --- | --- | --- |
66
-
| `==`| Equal | To compare numbers or string literals
67
-
| `!=`| Unequal| To compare numbers or string literals in opposite way to equals
68
-
| `<` | Less | To compare numbers
69
-
| `>` | Greater | To compare numbers
70
-
| `<=`| Less or equal | To compare numbers
71
-
| `>=`| Greater or equal | To compare numbers
72
-
| `~=`| Regular expression | To find the incoming right side in the left side.
73
-
|`in`| Find left element in the list of right elements. |
74
-
|`nin`| The same one as saying above but carrying the opposite sense. |
75
-
|`size`| The size of array on the left size should be corresponded to the number on the right side. |
76
-
|`noneOf`| The left size has no intersection with right |
77
-
|`anyOf`| The left size has at least one intersection with right |
78
-
| `subsetOf` | The left is a subset of the right side
79
-
| | Exists operator. | The operator checks the existens of the field depicted on the left side like that `[?(@.key.isActive)]`
0 commit comments