I thought this other SO thread would have answered my question (http://stackoverflow.com/questions/4883751/trouble-reading-json-object-in-python), as it is very similar to my problem, but the data there are a little different than the data in my case.
I have about 470 records pulled from the Twitter API for twitter user data, something like:
{
steve: {
follow_request_sent: false,
profile_use_background_image: true,
default_profile_image: false,
geo_enabled: true,
verified: false,
profile_image_url_https: "https://si0.twimg.com/profile_images/1416115378/profile_normal.jpg",
profile_sidebar_fill_color: "F8E846",
id: 1376271,
profile_text_color: "000000",
followers_count: 2042,
profile_sidebar_border_color: "FFFFFF",
location: "Dallas and 51°33′28″N 0°6′10″W",
profile_background_color: "7d0000",
listed_count: 110,
status: {
favorited: false,
contributors: null,
truncated: false,
text: "So Microsoft's cloud is down. Can't say I have noticed. To the cloud! (the Amazon one of course)",
created_at: "Wed Feb 29 15:51:44 +0000 2012",
retweeted: false,
in_reply_to_status_id: null,
coordinates: null,
id: 174884564718723070,
source: "<a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a>",
in_reply_to_status_id_str: null,
in_reply_to_screen_name: null,
id_str: "174884564718723073",
place: null,
retweet_count: 0,
geo: null,
in_reply_to_user_id_str: null,
in_reply_to_user_id: null
},
utc_offset: -21600,
statuses_count: 11504,
description: "Network engineer. Cisco, Juniper, F5, HP, EMC, etc. If it is in the data center I deal with it. Arsenal and Mavericks supporter to the max over at @steverossen",
friends_count: 822,
profile_link_color: "0000ff",
profile_image_url: "http://a0.twimg.com/profile_images/1416115378/profile_normal.jpg",
is_translator: false,
show_all_inline_media: false,
profile_background_image_url_https: "https://si0.twimg.com/profile_background_images/192104695/stadium.jpg",
id_str: "1376271",
profile_background_image_url: "http://a2.twimg.com/profile_background_images/192104695/stadium.jpg",
screen_name: "steve",
lang: "en",
profile_background_tile: false,
favourites_count: 0,
name: "Steve Rossen",
notifications: false,
url: "http://steverossen.com",
created_at: "Sat Mar 17 21:36:32 +0000 2007",
contributors_enabled: false,
time_zone: "Central Time (US & Canada)",
protected: false,
default_profile: false,
following: false
},
}
the problem being that each record starts with the person's twitter handle so is different for each record. So I've only been able to get so far as using:
import json
import csv
f = open('my.json')
data = json.load(f)
f.close()
for item in data:
print item
to print out those handles but can't figure out how to get into each person's record without having a key.
what am I grossly overlooking here? I would atleast like to get at the "description", which is nested inside of the users name as a key.