Examples
Print the help message
jstr --helpPrint file content (single line)
jstr package.jsonPrint file content (with spaces)
jstr -s 2 package.json # 2 spacesCopy file content
jstr -c package.jsonOmit output fields
jstr -o name,version package.jsonMap output fields
jstr -m '{"name":"foo"}' package.jsonPrint value of key using the callback parser
jstr package.json 'x => x.name'Multi-line parser callback
jstr package.json "
function capitalize({ name }) {
const head = name.charAt(0)
const tail = name.slice(1)
return head.toUpperCase() + tail
}
"Asynchronous parser callback
jstr package.json "async x => x.name"Using ts-belt
jstr package.json "D.get('name')"Reading from a piped command
echo '{"name":"foo"}' | jstr -i 'x => x.name'Generating a CSV file
jstr users.json "flow(A.map(D.get('friends')), A.flat)" --csv > users.csvCreating a text file using data from the JSON input
echo '{"name":"foo"}' | jstr -i "D.get('name')" > name.txtLast updated