File tree Expand file tree Collapse file tree 1 file changed +40
-1
lines changed
Expand file tree Collapse file tree 1 file changed +40
-1
lines changed Original file line number Diff line number Diff line change 11# json-skiff
22
3- A streaming JSON parser .
3+ A streaming JSON Pointer locator .
44
551 . Give it a list of JSON pointers and callbacks.
662 . Feed it JSON.
773 . Get notified when the target elements are seen.
88
99Less capable, but simpler and faster than the excellent [ JsonSurfer] ( https://github.com/wanglingsong/JsonSurfer ) library.
1010
11+ ## Usage
12+
13+ ### Selecting array elements
14+
15+ Normally, a ` - ` in a JSON Pointer refers to the last element of an array.
16+ ` json-skiff ` bends the rules a bit, and interprets ` - ` as matching _ all_ array elements.
17+
18+ Consider this JSON document:
19+
20+ ``` json
21+ {
22+ "magicWords" : [
23+ " alakazam" ,
24+ " xyzzy"
25+ ]
26+ }
27+ ```
28+ A callback associated with ` /magicWords/- ` is invoked a total of two times: once for ` "alakazam" ` and once for ` "xyzzy" ` .
29+
30+ The ` - ` does not need to be the last component of the pointer.
31+ Consider this JSON document:
32+
33+ ``` json
34+ {
35+ "widgets" : [
36+ {
37+ "serialNumber" : " 123"
38+ },
39+ {
40+ "serialNumber" : " XYZ"
41+ }
42+ ]
43+ }
44+ ```
45+
46+ A callback associated with ` /widgets/-/serialNumber ` is invoked a total of two times: once for ` "123" ` and once for ` "XYZ" ` .
47+
48+
49+ ## FAQ
1150
1251### Is this library an officially supported Couchbase product?
1352
You can’t perform that action at this time.
0 commit comments