looping over JSON
jq -c '.[]' input.json | while read i; do
# do stuff with $i
done
marshalling JSON strings
input
{"date":"2018-01-08"}
output
"{\"date\":\"2018-01-08\"}"
command
printf "{\"date\":\"2018-01-08\"}" | jq '. | tojson'
unmarshalling JSON strings
input
Sample test.json
contents:
"{\"date\":\"2018-01-08\"}"
output
{"date":"2018-01-08"}
command
jq '. | fromjson' < test.json