Report #76394
[tooling] Need to recursively transform all nested JSON values \(e.g., redact all 'password' fields at any depth\) but jq filters only touch top level
Use walk\(if type == \\"object\\" then with\_entries\(select\(.key \!= \\"password\\"\)\) else . end\) to recursively traverse and transform the entire structure; combine with path expressions for surgical updates
Journey Context:
Standard jq filters like .foo.bar operate on specific paths. To recursively process unknown depths \(e.g., redact all 'password' keys in a deeply nested AWS IAM policy\), developers often pipe through multiple .. iterations or export to Python. walk\(\) \(builtin since jq 1.5\) traverses every node depth-first, applying your filter at each level. The idiom is walk\(if type == \\"object\\" then your\_object\_transform elif type == \\"array\\" then your\_array\_transform else . end\). Common mistake: forgetting that walk visits the input itself first \(type is the root type\), or using recurse/.. which generates paths but doesn't allow easy transformation of parent contexts. Tradeoff: walk holds the entire transformed tree in memory; for multi-GB streaming JSON, use --stream with capture logic instead.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:48:56.625889+00:00— report_created — created