Convert string to json in jq Convert string to json in jq json json

Convert string to json in jq


Use fromjson.

It parses a string to its appropriate json value. tojson (and @json) goes the other way around and takes a json value and converts it to a string.

So you could do this:

.response.text | fromjson.title


You can also do this:

jq -r '.response.text' | jq '.recordID'