1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Author: Andreas Tille <tille@debian.org>
Last-Update: 2025-02-20
Forwareded: no
Description: Document functionality added in pr61.patch
--- a/jshon.1
+++ b/jshon.1
@@ -7,7 +7,7 @@
.Nd JSON parser for the shell
.Sh SYNOPSIS
.Nm jshon
-\-[P|S|Q|V|C|I|0] [\-F path] \-[t|l|k|u|p|a|j] \-[s|n] value \-[e|i|d|w] index
+\-[P|S|Q|V|C|I|0] [\-F path] \-[t|l|k|u|p|r|a|j] \-[s|n] value \-[e|i|d|w] index
.Sh DESCRIPTION
.Nm
parses, reads and creates JSON. It is designed to be as usable as possible from within the shell and replaces fragile adhoc parsers made from grep/sed/awk as well as heavyweight one-line parsers made from perl/python.
@@ -120,6 +120,17 @@ the new value, and then insert at the in
This option will wrap the top of the stack in given key.
.Pp
\& echo {"a": 1, "b": 2} | jshon \-e a \-w a2 \-i a becomes {"a": {"a2": 1},"b": 2}
+.Pp
+.It Cm -r
+Rotates the two top items on the stack. This allows for some powerful manipulations.
+.Pp
+Wrap a json as a value:
+.Pp
+\& echo '{"a":1, "b":2}' | jshon \-e a \-n object \-r \-i a2 \-i a becomes {"a": {"a2": 1}, "b":2}
+.Pp
+Selecting some items by key:
+.Pp
+\& echo '{"a":1, "b":2, "c":3}' | jshon \-e a \-r \-e b \-r \-p \-n object \-r \-i b \-r \-i a becomes {"b":2, "a":1}
.
.Pp
.El
|