-
Couldn't load subscription status.
- Fork 1
Text JSON
Vali (naser) Rafinia edited this page Mar 27, 2023
·
4 revisions
nhash is a command-line tool that provides various text utilities, including JSON tools. The json sub-command allows you to process JSON text, convert it to other formats, and print it in a pretty or compact format.
nhash text json [<text>] [options]-
<text>: JSON text for processing.
-
--print <Compact|Pretty>: Print the JSON representation in a pretty or compact format. -
-f, --file <file>: File name for reading JSON from. -
-c, --convert <JSON|XML|YAML>: Convert the JSON text to other formats (YAML or XML). -
-o, --output <output>: File name for writing the output. -
-?, -h, --help: Show help and usage information.
- Process JSON text:
nhash text json '{"name": "John Doe", "age": 30}'- Read JSON from a file:
nhash text json -f data.json- Convert JSON to YAML:
nhash text json '{"name": "John Doe", "age": 30}' -c yaml- Write the output to a file:
nhash text json '{"name": "John Doe", "age": 30}' --output output.txt- Print pretty JSON representation:
nhash text json '{"name": "John Doe", "age": 30}' --print pretty- Print compact JSON representation:
nhash text json '{"name": "John Doe", "age": 30}' --print compact