looping over JSON

jq -c '.[]' input.json | while read i; do
    # do stuff with $i
done

source

marshalling JSON strings

input
{"date":"2018-01-08"}
output
"{\"date\":\"2018-01-08\"}"
command
printf "{\"date\":\"2018-01-08\"}" | jq '. | tojson'

source

unmarshalling JSON strings

input

Sample test.json contents:

"{\"date\":\"2018-01-08\"}"
output
{"date":"2018-01-08"}
command
jq '. | fromjson' < test.json

source