beroca / shell

shell
0 stars 0 forks source link

jq #7

Open beroca opened 1 year ago

beroca commented 1 year ago

jq

beroca commented 1 year ago

https://gist.github.com/stefaneng/99db9882821620d9ba17785fdcac6794

echo '[{"key": 1}, {"key": 2}, {"key": 1}]' | jq 'group_by (.key)[] | {key: .[0].key, length: length}'
beroca commented 1 year ago

How to convert embedded (quoted) json string to json

-r output raw strings, not JSON texts;

jq -rc .stuff stuff.json
beroca commented 1 year ago

Parse your escaped JSON with jq and fromjson https://dev.to/lucassha/parse-your-escaped-json-jq-and-fromjson-4cpn

jq -r '.SecretString | fromjson | .SLACK_API_KEY'