This is a place where marcel's python grounding is really useful. Reading json, marcel generates a stream of nested dicts and lists. That stream can be turned back to json for output.
Similar for CSV.
The "tree" command will output JSON on fd3 (which it dubs 'stddata') when available.
If more programs adopt that pattern we could use stdout (fd1) only for interactive programs.
This is a pretty brilliant idea. Ideally, someone from BSD-land and GNU-land should meet and come up with some sane JSON schemas.
I will note that Powershell has typed inputs and outputs and that can be very powerful. Now if it weren't so verbose...
libxo has gone some way towards making that a reality in FreeBSD.