The code to flatten json objects and convert an array of json objects to CSV with column names generated dynamically.