├── UNLICENSE
├── jpipe.go
└── README.md
/UNLICENSE:
--------------------------------------------------------------------------------
1 | This is free and unencumbered software released into the public domain.
2 |
3 | Anyone is free to copy, modify, publish, use, compile, sell, or
4 | distribute this software, either in source code form or as a compiled
5 | binary, for any purpose, commercial or non-commercial, and by any
6 | means.
7 |
8 | In jurisdictions that recognize copyright laws, the author or authors
9 | of this software dedicate any and all copyright interest in the
10 | software to the public domain. We make this dedication for the benefit
11 | of the public at large and to the detriment of our heirs and
12 | successors. We intend this dedication to be an overt act of
13 | relinquishment in perpetuity of all present and future rights to this
14 | software under copyright law.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 | OTHER DEALINGS IN THE SOFTWARE.
23 |
24 | For more information, please refer to
` is worth a thousand words. For simple JSON values:
23 |
24 | $ echo '"Hello, World!"' | jpipe
25 | / "Hello, World!"
26 | $ echo 123 | jpipe
27 | / 123
28 | $ echo 0.25 | jpipe
29 | / 0.25
30 | $ echo null | jpipe
31 | / null
32 | $ echo true | jpipe
33 | / true
34 | $ echo false | jpipe
35 | / false
36 |
37 | The 'root' of the object tree is represented by a single `/` character,
38 | and for simple values it doesn't get any more complex than the above.
39 | Note that a single tab character separates the path on the left from the
40 | literal value on the right.
41 |
42 | Composite data structures use a hierarchical syntax, where individual
43 | keys/indices are children of the path to the containing object:
44 |
45 | $ echo '{"a": 1, "b": 2}' | jpipe
46 | / {}
47 | /a 1
48 | /b 2
49 | $ echo '["foo", "bar", "baz"]' | jpipe
50 | / []
51 | /0 "foo"
52 | /1 "bar"
53 | /2 "baz"
54 |
55 | For an object or array, the right-hand column indicates the datatype,
56 | and will be either `{}` (object) or `[]` (array). For objects, the order
57 | of the keys is preserved in the output.
58 |
59 | The path syntax allows arbitrarily complex data structures:
60 |
61 | $ echo '[{"a": [{"b": {"c": ["foo"]}}]}]' | jpipe
62 | / []
63 | /0 {}
64 | /0/a []
65 | /0/a/0 {}
66 | /0/a/0/b {}
67 | /0/a/0/b/c []
68 | /0/a/0/b/c/0 "foo"
69 |
70 |
71 | ## Caveat: Path Separators
72 |
73 | Because the path components are separated by `/` characters, an object
74 | key like `"abc/def"` would result in ambiguous output. jpipe will
75 | throw an error if this occurs in your input, so that you can recognize
76 | and handle the issue. To mitigate the problem, you can choose a
77 | different path separator:
78 |
79 | $ echo '{"abc/def": 123}' | jpipe -k '☃'
80 | ☃ {}
81 | ☃abc/def 123
82 |
83 | The Unicode snowman is chosen here because it's unlikely to occur as
84 | part of the key in most JSON objects, but any character or string (e.g.
85 | `:`, `::`, `~`) will do.
86 |
87 |
88 | ## Unlicense
89 |
90 | This is free and unencumbered software released into the public domain.
91 |
92 | Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
93 | software, either in source code form or as a compiled binary, for any purpose,
94 | commercial or non-commercial, and by any means.
95 |
96 | In jurisdictions that recognize copyright laws, the author or authors of this
97 | software dedicate any and all copyright interest in the software to the public
98 | domain. We make this dedication for the benefit of the public at large and to
99 | the detriment of our heirs and successors. We intend this dedication to be an
100 | overt act of relinquishment in perpetuity of all present and future rights to
101 | this software under copyright law.
102 |
103 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
104 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
105 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
106 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
107 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
108 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
109 |
110 | For more information, please refer to
111 |
--------------------------------------------------------------------------------