JSON Object to CSV File Troubleshooting

Denis McMahon denismfmcmahon at gmail.com
Sun Jun 21 02:50:11 EDT 2015


On Thu, 18 Jun 2015 18:47:30 -0700, Sahlusar wrote:

> I have a conundrum regarding JSON objects and converting them to CSV:
> 
> Context
> 
> I am converting XML files to a JSON object (please see snippet below)
> and then finally producing a CSV file. Here is a an example JSON object:

This is where you're going wrong. If you want CSV data, take the XML and 
generate CSV data from it. Converting and writing it out to JSON and then 
reading it back and converting to CSV involves an extra conversion step 
where errors can creep in.

If you want to convert XML to CSV, go straight from XML to CSV, there is 
little added value in using some arbitrary intermediate format unless 
you're actually going to use the data in the intermediate format for 
something other than converting to the final format.

-- 
Denis McMahon, denismfmcmahon at gmail.com



More information about the Python-list mailing list