

Each JSON record may be on a distinct line, like in the JSONLines/MongoDb format.

One such possibility is a single object with a single attribute that has an array of name/value pairs. With insert(), just indicate the position in the row you want the data point to occupy as the first argument.The objects in your JSON input should be an array of name/value pairs. To add additional data to the fixture history, you can add insert statements before writing the rows: import csv Just run python fix_hist.py in your command prompt (or terminal for mac): import csvį = csv.writer(open("fix_hists.csv","wb+")) If you copy the following code into a file and save it as fix_hist.py or something, then save your JSON file as file.json in the same directory, it will create a csv file with the fixture histories each saved as a row. Python has some good libraries for doing this. And for each element in that array, we print the player ID, their web_name and then the data from fixture_history. Then we loop through each of them - extracting the the fixture_history array. So we extract the keys from this hash - which is the ID number right at the beginning of each entry. This data structure is a nested hash (perl's term for the type of data structure).

Hopefully you can see what's going on here - you load the file $input, and decode_json to create a data structure.
