Skip to content

Recursive Oneliners

nntrn edited this page Jun 28, 2023 · 1 revision

Perform recursively to every component

Parse json strings

jq 'walk( fromjson? // .)'

Delete keys

jq 'walk(if type == "object" then del(.key0, .key1) else . end)'

jq '(.. | select(type == "object")) |= del(.changes, .id)'

Strip empty strings from arrays

jq 'walk(if type == "array" then map(select(length > 0)) else . end)'

Clone this wiki locally