33
44- [ jsonpath-python] ( #jsonpath-python )
55 - [ Features] ( #features )
6+ - [ Issues] ( #issues )
67 - [ Examples] ( #examples )
7- - [ Fields-Extractor ] ( #fields-extractor )
8- - [ Multi-selection and inverse-selection filtering ] ( #multi-selection-and-inverse-selection-filtering )
9- - [ Sorting by multiple fields, ascending and descending order ] ( #sorting-by-multiple-fields-ascending-and-descending-order )
8+ - [ Filter ] ( #filter )
9+ - [ Sort ] ( #sort )
10+ - [ Output mode: FIELD (In progress) ] ( #output-mode-field-in-progress )
1011
1112<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1213
@@ -17,13 +18,12 @@ A more powerful JSONPath implementations in modern python.
1718## Features
1819
1920- [x] Light. (No need to install third-party dependencies.)
20- - [ ] Support fields-extractor.
21- - [ ] Powerful filtering function, including multi-selection, inverse-selection filtering.
22- - [ ] Powerful sorting function, including sorting by multiple fields, ascending and descending order.
23-
24- ## Issues
25-
26- - Not support parent operator.
21+ - [x] Powerful filtering function, including multi-selection, inverse-selection filtering.
22+ - [x] Powerful sorting function, including sorting by multiple fields, ascending and descending order.
23+ - [x] Support output mode: VALUE
24+ - [ ] Support output mode: PATH
25+ - [ ] Support output mode: FIELD
26+ - [ ] Support parent operator
2727
2828## Examples
2929
@@ -68,41 +68,10 @@ data = {
6868}
6969```
7070
71- ### Fields-Extractor
72-
73- ``` python
74- >> > JSONPath(" $.store.book[*][title,price]" ,result_type = " FIELD" ).parse(data)
75- ```
76-
77- ``` json
78- {
79- "store" : {
80- "book" : [
81- {
82- "title" : " Sayings of the Century" ,
83- "price" : 8.95
84- },
85- {
86- "title" : " Sword of Honour" ,
87- "price" : 12.99
88- },
89- {
90- "title" : " Moby Dick" ,
91- "price" : 8.99
92- },
93- {
94- "title" : " The Lord of the Rings" ,
95- "price" : 22.99
96- }
97- ]
98- }
99- }
100- ```
101-
102- ### Multi-selection and inverse-selection filtering
71+ ### Filter
10372
10473``` python
105- >> > JSONPath(" $.store.book[?(@.price>8.95 && @.price<=20 || @.title!=' Sword of Honour')] " ).parse(data)
74+ >> > JSONPath(' $.store.book[?(@.price>8.95 and @.price<=20 and @.title!=" Sword of Honour")] ' ).parse(data)
10675```
10776
10877``` json
@@ -117,10 +86,10 @@ data = {
11786]
11887```
11988
120- ### Sorting by multiple fields, ascending and descending order
89+ ### Sorter
12190
12291``` python
123- >> > JSONPath(" $.store.book[\ category,/ price]" ).parse(data)
92+ >> > JSONPath(" $.store.book[/(~ category,price) ]" ).parse(data)
12493```
12594
12695``` json
@@ -153,3 +122,34 @@ data = {
153122 }
154123]
155124```
125+
126+ ### Field-Extractor (In progress)
127+
128+ ``` python
129+ >> > JSONPath(" $.store.book[*][title,price]" ,result_type = " FIELD" ).parse(data)
130+ ```
131+
132+ ``` json
133+ {
134+ "store" : {
135+ "book" : [
136+ {
137+ "title" : " Sayings of the Century" ,
138+ "price" : 8.95
139+ },
140+ {
141+ "title" : " Sword of Honour" ,
142+ "price" : 12.99
143+ },
144+ {
145+ "title" : " Moby Dick" ,
146+ "price" : 8.99
147+ },
148+ {
149+ "title" : " The Lord of the Rings" ,
150+ "price" : 22.99
151+ }
152+ ]
153+ }
154+ }
155+ ```
0 commit comments