![]() You need to essentially flatten the structure yourself, perhaps decide what is important or what you want to can leave out. under "result" there "fields" and then more values, and CSV files can't display that directly. There is no simple way to write this directly to a CSV file, because there are nested structures: e.g. The issue is that is will parse it a little strangely. It can read straight from a JSON string (our text above). I would suggest using Pandas, which can do a lot of the tedious work for you very easily. ![]() We can use the json module's function loads to load a string): json_data = json.loads(text) The response in this case is a raw string. We get the text data out by using the read() method: text = response.read() Import json # Used to load data into JSON format It is in Python 2, but I will show you how to make it work in Python 3. On the page you linked there is actually a Python example on how to get the data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |