0.1.3 • Published 7 years ago

@lafferty-lounge/json v0.1.3

Weekly downloads
-
License
WTFPL
Repository
gitlab
Last release
7 years ago

@lafferty-lounge/json

The json-ll utility lets you easily inspect, merge, modify, and export JSON and yaml

Installation

npm install -g @lafferty-lounge/json

Usage

json-ll [object path] (--options, ...)

Examples

Read from stdin

echo '{"foo": ["bar"]}' | json-ll foo # -> ["bar"]
echo '{"foo": ["bar"]}' | json-ll foo[0] # -> bar

Read from inline

json-ll foo -f '{"foo": ["bar"]}' # -> ["bar"]
json-ll foo[0] -f '{"foo": ["bar"]}' # -> bar

Read from file

foo.yaml

foo:
  - bar
json-ll foo -f foo.yaml # -> ["bar"]
json-ll foo[0] -f foo.yaml # -> bar

Merging values

json-ll -f '{"foo": {"bar": "baz"}}' --fs foo.bar -t '{"bar": "qux"}' --ts bar # -> '{"foo": {"bar": "qux"}}'

Flags

ArgumentsShorthandInputDefaultDescription
--to-t- , /filepath, '{ "inline" : "json" }'-The source of 'to' JSON/yaml when merging. Read from stdin (-), a file (/filepath), or parse the raw --to argument ('{}').
--from-f-, /filepath, '{ "inline" : "json" }'-The source of 'from' JSON/yaml when merging. Read from stdin (-), a file (/filepath), or parse the raw --from argument ('{}')
--to-selector--tsobject.path.0.syntaxThe object/property path to set in the 'to' JSON
--from-selector--fsobject.path0.syntaxThe object/property path to take from the 'from' JSON
--value-v-, '{ "inline" : "json" }'The value to use in place of the 'from' JSON content.
--selector-sobject.path.0.syntaxThe object path to use when no merging is taking place.
--output-file--of/filepathThe file to write the output of the command to if specified. Content is printed to stdout by default.
--keys-kfalseList only the keys for an object path
--newline-nfalseWhen set the newline that normally appears at the end of the output is ignored. (Don't write newline)
--spaces-1,0,1,2,...3When outputting in the JSON format the --spaces flag tells how many spaces to use for indentation. -1 for no indentation.
--output-oraw, pretty, json, yamlprettyWhat format to output the data in

Quirks

  • You can't escape . yet so you can't use keys with literal dots.
0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago