json: Add file handling for debug output