Access embedded json in value

37 Views Asked by At

Is there any chance to access a embedded json value inside a value? The assume json example looks like this:

{
  "key": "{\"test\":1,\"check\":\"default\"}"
}

This is more of a curiosity question.

What I always do today is

echo '{"key": "{\"test\":1,\"check\":\"default\"}"}' | jq -r .key | jq .test

and I get 1 for this example.

However I am curious if there is any possibility to omit the second jq pipe and to basically dense this down to one jq command.

0

There are 0 best solutions below