preserve input file type type
... by first trying JSON, and default to outputting the same file type as the input