The idea was to make sure only the JSON was output to a file. There are random bits that also like to output to stdout (1) and that's part of the problem.

This is an explicitly open file descriptor 3 and output the JSON to it.
Also because we have some ugly wrapping done in the shell script to make the JSON an array of things.