On Sunday, June 21, 2015 at 4:54:27 PM UTC-4, Denis McMahon wrote: > On Sun, 21 Jun 2015 06:57:01 -0700, sahluwalia wrote: > > > On Sunday, 21 June 2015 02:47:31 UTC-4, Denis McMahon wrote: > >> On Wed, 17 Jun 2015 08:00:11 -0700, Saran A wrote: > >> > >> > I would like to have this JSON object written out to a CSV file so > >> > that the keys are header fields (for each of the columns) and the > >> > values are values that are associated with each header field. > >> > >> > { > >> > "CF": { > >> ....... > >> > "CF": "Fee", > >> > >> Your json object seems to have the same key used for two elements at > >> the same level, are you sure this is legal json? > > > I converted this from an XML file given to me from a third party. It is > > as is. I am not sure what you mean by "valid"; that is a very subjective > > measure for any form of quantitative or qualitative data. > > Put it this way, when I feed your json object into a jason lint, the > output is the following: > > { > "CF": "Fee", > "ID": "2" > } > > The second occurrence in the parent object of name "CF" with a value of > string literal "Fee" overwrites the earlier name "CF" whose value is (in > python terms) a dictionary or (in json terms) an object. > > -- > Denis McMahon, denismfmcma...@gmail.com
I am stepping back and rethinking the notion of JSON/dictionaries. Maybe this was a very overcomplicated approach for this type of data. -- https://mail.python.org/mailman/listinfo/python-list