Question:
I would like to pretty print a json string I copied from an API call which contains escaped double quotes.Similar to this:
pbpaste | jq "."
the result is not changed and is still in one line.I guess the problem are the escaped double quotes, but I don’t know how to tell
jq
to remove them if possible, or any other workaround.Answer:
What you have is a JSON string which happens to contain a JSON object. You can decode the contents of the string with thefromjson
function.If you have better answer, please add a comment about this, thank you!