使用Node.js获取特定的JSON数据

时间:2015-04-13 06:25:44

标签: javascript json node.js mongodb

我有MongoDB中各种推文的存储数据,我用JSON格式显示如下。我只想从这个批量数据中获取位置名称,并使用node.js将其显示在另一个页面上。

任何人都可以帮助我这样做,这将是一个很大的帮助

{
    "_id": "5524d1c72d02a4bce134cabd",
    "id": 585697991878639600,
    "created_at": "Wed Apr 08 06:57:37 +0000 2015",
    "id_str": "585697991878639618",
    "text": "Friends follow @ArtistAloud page join this contest and win cool fk voucher #AAMA2014 @Mika0562  
             @genver1 @BabuBeg @sunitakatyal @sweet_isha1",
    "source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
    "truncated": false,
    "in_reply_to_status_id": null,
    "in_reply_to_status_id_str": null,
    "in_reply_to_user_id": null,
    "in_reply_to_user_id_str": null,
    "in_reply_to_screen_name": null,
    "user": {
      "id": 141550730,
      "id_str": "141550730",
      "name": "Anuradha Chhabra",
      "screen_name": "freeky9219",
      "location": "Mumbai",
      "url": null,
      "description": null,
      "protected": false,
      "verified": false,
      "followers_count": 1274,
      "friends_count": 1692,
      "listed_count": 11,
      "favourites_count": 24669,
      "statuses_count": 57491,
      "created_at": "Sat May 08 11:10:09 +0000 2010",
      "utc_offset": null,
      "time_zone": null,
      "geo_enabled": true,
      "lang": "en",   
 },
{
    "_id": "552b5f3081d03fdca14c0d74",
    "id": 587499514560405500,
    "created_at": "Mon Apr 13 06:16:14 +0000 2015",
    "id_str": "587499514560405504",
    "text": "RT @ErnestoRiley: Look, friends tease each other. It's how we show love.\nSo everyone just Chill..\nAnd be respectful with your comments ðŸŒ",
    "source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>",
    "truncated": false,
    "in_reply_to_status_id": null,
    "in_reply_to_status_id_str": null,
    "in_reply_to_user_id": null,
    "in_reply_to_user_id_str": null,
    "in_reply_to_screen_name": null,
    "user": {
      "id": 2239133156,
      "id_str": "2239133156",
      "name": "21.04.15《",
      "screen_name": "justlorina",
      "location": "Sophia & Katie â¤ï¸ ",
      "url": "http://Instagram.com/justlorina_",
      "description": "The Vampire Diaries is the Story of Elena falling in love with Damon -LJ. Smith • #PLL #TW addicted • I met Ian 17/18 May 2014 • [Books||Shows||Movies||Music]",
      "protected": false,
      "verified": false,
      "followers_count": 3440,
      "friends_count": 998,
      "listed_count": 21,
      "favourites_count": 17533,
      "statuses_count": 34057,
      "created_at": "Tue Dec 10 13:05:42 +0000 2013",
      "utc_offset": 7200,
      "time_zone": "Berlin",
      "geo_enabled": true,
      "lang": "en",
      "contributors_enabled": false,
      "is_translator": false,
    }

1 个答案:

答案 0 :(得分:0)

我建议你搜索谷歌的mean.js和mean.io,两者都为基于Mongo和Node的应用程序提供了一个非常好的起点(带有Express和Angular,因此是MEAN),还有一些额外的好处