jf-0.1.0 is not a library.
Visit the last successful build:
jf-0.6.2
jf
jf "jf: %q" "JSON Format"
jf is a jo alternative to help safely format and print JSON objects in the commandline.
However, unlike jo
, where you build the JSON object by nesting jo
outputs,
jf
works similar to printf
, i.e. it expects the template in YAML format as the first argument, and then the values for the placeholders as subsequent arguments.
Usage
Where TEMPLATE may contain the following placeholders:
%q
: Placeholder for quoted and safely escaped JSON string.%s
: Placeholder for JSON values other than string.%%
: Placeholder for a single%
(i.e. escaped%
).
And [VALUE]... are the values for the placeholders.
Use %%
to escape a literal %
character.
Example:
# jo hello=world
# {"hello":"world"}
# jo hello=$(jo beautiful=world)
# {"hello":{"beautiful":"world"}}
# jo d[m]=10 d[n]=20
# {"d":{"m":10,"n":20}}
# jo -d\|first_char_only a\|b=0 a\|c\|d=1 a\|d\|e[]=2 a\|d\|e[]=sam a\|c[f]@1 b\|e[]g=hi
# {"a":{"b":0,"c":{"d":1,"f":true},"d":{"e":[2,"sam"]}},"b":{"e":["hi"]}}