'How to save JSON to CSV?
I am trying to use a raw data output from mixpanel API and save all events to a .csv. Mixpanel gives me the following data as <class 'str'>:
{"event":"Test Event","properties":{"time":16423986,"distinct_id":"XXXXX-XXXX-XXX-XXXXX-XXXXX","$browser":"Chrome"}}
{"event":"Test Event","properties":{"time":16412321,"distinct_id":"XXXXX-XXXX-XXX-XXXXX-XXXXX","$browser":"Chrome"}}
{"event":"Test Event","properties":{"time":16412311,"distinct_id":"XXXXX-XXXX-XXX-XXXXX-XXXXX","$browser":"Chrome"}}
I would like to have a .csv file with the following, making sure I can select which fields I want (in this case, I would have excluded distinct_id):
event, time, $browser
Test Event, 16423986, Chrome
Test Event, 16412321, Chrome
Test Event, 16412311, Chrome
I have researched other questions but had no success by now, I would really appreciate your help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
