Quantcast
Channel: Bash: convert lower level JSON to escaped string - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Bash: convert lower level JSON to escaped string

$
0
0

I am struggling to use jq to massage the input data so that the first level keys are preserved, while the lower level JSON gets converted to escaped strings.

Input JSON:

{"a": "1","b": {"c": "2","d": {"e": "3"    }  },"f": "4"}

Desired output:

{"a": "1","b": "{ \"c\": \"2\", \"d\": { \"e\": \"3\"} }","f": "4"}

Is there a "pure"jq solution to this?


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images