Copy outfuncs.c and modify to output JSON.