For others whom happen to search for this as I just did. The router approach is still required as far as I can tell for the “No Data” condition, but, an easier way to write a header only file is to parse your JSON and use a Constant with a File Writer. For example, the following will get a list of Keys from your JSON (headers) as an array, turn it into a string, then, remove the opening and closing brackets.
JSON.stringify(Object.keys($)).replace(“[”,“”).replace(“]”,“”)
You can drop that into a Constant Snap and write to file. Works well for this case.