Options
Help
Boolean
Used as --help
Prints the help message will all the options available for use, description about each positional argument from the command, examples and more:
jstr --help
Input
Boolean
Used as --input
or -i
Reads a JSON input from the stdin
(a piped command, for example) rather than from a file path:
cat my-file.json | jstr -i
The command above is equivalent to:
jstr my-file.json
This option is quite useful if your JSON output comes from another command/script.
Copy
Boolean
Used as --copy
or -c
Copies the output to your clipboard rather than printing it:
jstr -c my-file.json
One of the original needs for a tool like this was to use it on env. variables that were a stringified JSON, this option is quite useful for that.
CSV
Boolean
Used as --csv
Formats the output to CSV:
jstr --csv my-file.json
Or if you want the output saved to a file:
jstr --csv my-file.json > my-file.csv
Clipboard
Boolean
Used as --clipboard
Reads a JSON input from the clipboard:
jstr --clipboard
Map
String
Used as --map
or -m
Accepts a JSON to use as a map for field -> alias
transformation:
jstr my-file.json -m '{"myKey":"myNewKey"}'
The example above will simply rename myKey
to myNewKey
.
The order of keys is not always guaranteed after mapping them, so do not expect your output to have the same keys order after using the --map
option.
Omit
String
Used as --omit
or -o
Omits/removes comma separated fields from the output:
jstr -o name,version package.json
Prefix
String
Used as --prefix
Adds a prefix to every key of the object passed as input.
If the object is an array of objects, it will add the prefix to every object in it:
jstr --prefix foo my-file.json
Suffix
String
Used as --suffix
Adds a suffix to every key of the object passed as input.
If the object is an array of objects, it will add the suffix to every object in it:
jstr --suffix bar my-file.json
Spaces
Number
Used as --spaces
or -s
Adds spaces to the output.
The number provided equals the number of spaces added in the indentation:
jstr -s 2 my-file.json
Last updated