从这里可以看到(https://dev.twitter.com/docs/api/1/get/statuses/home_timeline),一条推文有很多信息(字段),因此存储推文并不容易MySQL 中的信息。
如果我把这个 JSON 做成数组,它就不是 1-depth 数组。例如,就像这个 JSON 中的 URL 实体一样,它可能在一个“实体”字段中有很多 URL。
我是否应该将此信息存储为一个字段中的“urls[{"aa": a, "bb": b}, {"aa": c, "bb": d}]" 之类的字符串?或者有没有最好的存储方式?
{
"coordinates": null,
"favorited": false,
"created_at": "Fri Jul 16 16:58:46 +0000 2010",
"truncated": false,
"entities": {
"urls": [
{
"expanded_url": null,
"url": "http://www.flickr.com/photos/cindyli/4799054041/",
"indices": [
75,
123
]
}
],
"hashtags": [
],
"user_mentions": [
{
"name": "Stephanie",
"id": 15473839,
"indices": [
27,
39
],
"screen_name": "craftybeans"
}
]
},
"text": "got a lovely surprise from @craftybeans. She sent me the best tshirt ever. http://www.flickr.com/photos/cindyli/4799054041/ ::giggles::",
"annotations": null,
"contributors": null,
"id": 18700887835,
"geo": null,
"in_reply_to_user_id": null,
"place": null,
"in_reply_to_screen_name": null,
"user": {
"name": "cindy li",
"profile_sidebar_border_color": "AD0066",
"profile_background_tile": false,
"profile_sidebar_fill_color": "AD0066",
"created_at": "Wed Nov 29 06:08:08 +0000 2006",
"profile_image_url": "http://a1.twimg.com/profile_images/553508996/43082001_N00_normal.jpg",
"location": "San Francisco, CA",
"profile_link_color": "FF8500",
"follow_request_sent": false,
"url": "http://www.cindyli.com",
"favourites_count": 465,
"contributors_enabled": false,
"utc_offset": -28800,
"id": 29733,
"profile_use_background_image": true,
"profile_text_color": "000000",
"protected": false,
"followers_count": 3395,
"lang": "en",
"notifications": true,
"time_zone": "Pacific Time (US & Canada)",
"verified": false,
"profile_background_color": "cfe8f6",
"geo_enabled": true,
"description": "Just me, Cindy Li.Giving cute substance since 1997.\r\nMarried to @themattharris.\r\nProduct designer for Yahoo! ",
"friends_count": 542,
"statuses_count": 4847,
"profile_background_image_url": "http://a3.twimg.com/profile_background_images/3368753/twitter_flowerbig.gif",
"following": true,
"screen_name": "cindyli"
},
"source": "web",
"in_reply_to_status_id": null
},