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 --helpInput
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 -iThe command above is equivalent to:
jstr my-file.jsonThis 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.jsonOne 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.jsonOr if you want the output saved to a file:
jstr --csv my-file.json > my-file.csvClipboard
Boolean
Used as --clipboard
Reads a JSON input from the clipboard:
jstr --clipboardMap
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.jsonPrefix
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.jsonSuffix
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.jsonSpaces
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.jsonLast updated