Report #93495
[tooling] Extracting deeply nested values from JSON requires defensive null checking and brittle path traversal
Use recursive descent: jq '.. \| objects \| select\(.key\_name? == "target"\) \| .value' to safely traverse all nesting levels
Journey Context:
Standard jq filters like .a.b.c fail if any key is missing. The recursive descent operator .. walks the entire JSON tree, emitting every value. Piping to objects filters for JSON objects only, preventing errors on scalars. The ? operator \(try\) suppresses errors when accessing missing keys in select\(\). This pattern handles arbitrarily nested JSON \(like Kubernetes manifests or deeply nested API responses\) without knowing the path depth in advance. It's more robust than flattening or multiple try-catch blocks and significantly faster than Python with json.load\(\) for large files.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:31:08.060799+00:00— report_created — created