Skip to content

Instantly share code, notes, and snippets.

View deas's full-sized avatar

Andreas Steffan deas

View GitHub Profile
#!/bin/sh
depth=$1
jq 'def scrub(n):
if type == "object" then
if n == 0 then empty
else map_values(scrub(n - 1)) | with_entries(select(.value != null))
end
elif type == "array" then
if n == 0 then empty
else map(scrub(n - 1))