I have the following json file (output.json) with control characters in it (line break, tabs, etc):
{"data”:{“gherkin”:”Given user successful login
And status is '<currentStatus>'
When user clicks '<nextStatus>’
Then status message should change to '<message>'
Examples:
| currentStatus | nextStatus | message |
| READY | PROCESS | ready to process |
| PROCESS | COMPLETE | ready to complete |
"}}
I need to get the value from "gherkin" field and write it into another file keeping the same format as in the original json.
When using jq command:
jq .data.gherkin output.json
it throws an error:
parse error: Invalid string: control characters from U+0000 through U+001F must be escaped at line 9, column 1
If I remove all control characters from output.json, I will lose the original format of the value of "gherkin" field. Is there a way to accomplish this using jq?
Thanks!