coding · Any · free
Write a jq filter that transforms this JSON into what I need. Input JSON (representative sample): Desired output (exact shape): Constraints: Streaming (huge file, use stream)? [Y/N] Preserve field order? [Y/N] Missing fields should be: [OMITTED / null / DEFAULT VALUE] Deliver: 1. The filter — start simple, one pipeline 2. A commented version showing what each stage does 3. The exact jq invocation including flags I need ( r, c, s, arg, argjson) 4. The three ways to break it — and the defensive versions (?, // empty, try/catch) 5. If the transform is complex enough to hurt — the "when to reach for a real script" line and the Python equivalent Anti patterns to reject: Wrapping the whole thing in a shell for loop (jq iterates) | tostring | fromjson roundtrips grep post processing when select() would work
#jq #json #shell