Webux Lab - Blog
Webux Lab Logo

Webux Lab

By Studio Webux

Search

By Tommy Gingras

Last update 2024-11-10

JSON

Bash and JQ Commands notes

Convert all values to string inside an object.

jq '.initialFunds = (.initialFunds | to_entries | map(.value |= tostring) | from_entries)' \
    INPUT.json > INPUT.tmp && mv INPUT.tmp OUTPUT.json

Delete an Object and save the rest of the JSON input.

jq 'del(.staking)' OUTPUT.json > OUTPUT.tmp && mv OUTPUT.tmp OUTPUT.json