如果我將JSON數據存儲在名爲'data'的字符串中(例如下面的示例),如何訪問特定信息(如messages->unread
或pokes->most_recent
)?從哪裏開始解析JSON?
{
"messages": {
"unread": 0,
"most_recent": 1300047276
},
"pokes": {
"unread": 0,
"most_recent": 0
},
"shares": {
"unread": 0,
"most_recent": 0
},
"friend_requests": [],
"group_invites": [],
"event_invites": []
}
我想是這樣data['messages']['unread']
工作 - 但當然不會,當我的數據存儲爲一個字符串!
json和simplejson之間有區別嗎? – 8128 2011-03-13 21:33:32
@fluteflute:看到這裏:http://stackoverflow.com/questions/712791/json-and-simplejson-module-differences-in-python – 2011-03-13 21:43:08