在JavaScript中解析JSON字符串

时间:2013-07-24 09:35:50

标签: javascript json

我有这个json字符串:

{"conn": "wifi", "result": "ok", "build_id": 0, "content": {"ad_instream": {"clickthrough": "", "tracking": {"impression": ["http:\\\/\\\/pubads.g.doubleclick.net\\\/pagead\\\/adview?ai=BcTWwqp7vUe3HGtDa0AHQjoCYCO3Fn_0EAAAAEAEgADgAWKWn-_lbYPmCgICcEIIBF2NhLXB1Yi0yNjE0NjY2MjYxNTc5NzQxsgEYd3d3LmRjbGstZGVmYXVsdC1yZWYuY29tugEJZ2ZwX2ltYWdlyAEJ2gEgaHR0cDovL3d3dy5kY2xrLWRlZmF1bHQtcmVmLmNvbS_AAgLgAgDqAiQ0MDYxL21vYmkueXRwd2F0Y2gubXVzaWMvbWFpbl8zOTk2Njn4AvzRHpADhAeYA-ADqAMB0ASQTuAEAaAGINgGAg\\u0026sigh=Ys7UKZRdfi0\\u0026adurl=http:\\\/\\\/pagead2.googlesyndication.com\\\/pagead\\\/imgad\\\/879366\\\/dot.gif?1960307723"]}, "title": "", "duration": 0, "message": "", "companion_image": "", "encrypted_id": "", "source": "", "stream_url": ""}, "branding": null, "allow_ratings": true, "sentiment_xsrf_token": "7M7BB4lZtPAP55lTgHX-uubKznZ8MTM3NDc0NDYxOEAxMzc0NjU4MjE4", "channel_subscriber_count": 6221321, "ptracking": "\\\/\\\/www.youtube.com\\\/ptracking?oid=VyEtjbeN302yXkP3Qulrog\\u0026ptchn=officialpsy\\u0026ptk=ygent\\u0026video_id=9bZkp7q19f0\\u0026pltype=content", "next_url": "\\\/related?v=9bZkp7q19f0\\u0026page=2", "subscribe_xsrf_token": "opnXNXthIo8ifJHxFIzcoDeCFxd8MTM3NDc0NDYxOEAxMzc0NjU4MjE4", "player_data": {}, "video": {"player_type": "html5fs", "profile_url": "\\\/user\\\/officialpsy", "title": "PSY - GANGNAM STYLE (\\uac15\\ub0a8\\uc2a4\\ud0c0\\uc77c) M\\\/V", "duration": "4:13", "watch_link": "\\\/watch?v=9bZkp7q19f0", "public_name": "officialpsy", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/9bZkp7q19f0\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=Y3_yUSuTAw53AwGBBy62wc6U5W0", "description": "PSY - Gangnam Style (\\uac15\\ub0a8\\uc2a4\\ud0c0\\uc77c) \\n\\u25b6 NOW available on iTunes: http:\\\/\\\/Smarturl.it\\\/psygangnam\\n\\u25b6 Official PSY Online Store US \\u0026 International : http:\\\/\\\/psy.shop.bravadousa.com\\\/\\n\\u25b6 About PSY from YG Ent.: http:\\\/\\\/smarturl.it\\\/YGfamilyAboutPSY\\n\\u25b6 PSY's Products on eBay: http:\\\/\\\/stores.ebay.com\\\/ygentertainment\\n\\u25b6 YG-eShop: http:\\\/\\\/www.ygeshop.com\\n \\n===============================\\nPSY CONCERT \\"HAPPENING\\"\\n2013.4.13. SAT 6:30PM\\nTHE SEOUL WORLD CUP STADIUM\\nYouTube LIVE@ http:\\\/\\\/www.youtube.com\\\/officialpsy\\nTickets: http:\\\/\\\/smarturl.it\\\/PsyHappeningKor\\nEnglish Booking: http:\\\/\\\/smarturl.it\\\/PsyHappeningEng\\n===============================\\n\\nFor More Information @\\nhttp:\\\/\\\/www.facebook.com\\\/officialpsy\\nhttp:\\\/\\\/twitter.com\\\/psy_oppa\\nhttp:\\\/\\\/twitter.com\\\/ygent_official\\nhttp:\\\/\\\/me2day.net\\\/psyfive\\nhttp:\\\/\\\/www.psypark.com\\nApp Store: http:\\\/\\\/goo.gl\\\/l9TU6\\nGoogle Play: http:\\\/\\\/goo.gl\\\/UiEn1\\n\\n\\u00a9 YG Entertainment Inc. All rights reserved.", "likes_num": 7726014, "comment_count": 6180686, "playability": "PLAY_OK", "thumbnail_info": null, "length_seconds": 253, "dislikes_num": 841590, "view_count": "1,711,794,985", "encrypted_id": "9bZkp7q19f0", "fmt_stream_map": [{"quality": "medium", "type": "video\\\/mp4; codecs=\\"avc1.42001E, mp4a.40.2\\"", "itag": "18", "fallback_host": "tc.v20.cache4.c.youtube.com", "url": "http:\\\/\\\/r2---sn-cx1x9-ua8e.c.youtube.com\\\/videoplayback?ratebypass=yes\\u0026source=youtube\\u0026sver=3\\u0026fexp=903903%2C923432%2C924368%2C910207%2C906934%2C916612%2C919515%2C909546%2C929117%2C929121%2C929906%2C929907%2C925720%2C925722%2C925718%2C925714%2C929917%2C929919%2C912521%2C904830%2C919373%2C904122%2C932216%2C908534%2C919387%2C936303%2C909549%2C935006%2C900816%2C936301%2C912711%2C935000%2C921057\\u0026ms=au\\u0026mv=m\\u0026mt=1374658182\\u0026dnc=1\\u0026el=watch\\u0026upn=dChGeGD9MuE\\u0026app=youtube_mobile\\u0026ip=109.67.165.16\\u0026sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire\\u0026id=f5b664a7bab5f5fd\\u0026cp=U0hWSVZTUF9LS0NONl9OTVRIOnNFdUFFYTMyLVU3\\u0026yms=vHvXEy72-S8\\u0026expire=1374682761\\u0026gcr=il\\u0026ipbits=8\\u0026itag=18\\u0026key=yt1\\u0026signature=ABB860A1271B7F8B5EBF49ADE0DE0CFE7F7201B8.561762632D8B55ECC5BA2F77B72E5917B84F4CED"}, {"quality": "small", "type": "video\\\/3gpp; codecs=\\"mp4v.20.3, mp4a.40.2\\"", "itag": "36", "fallback_host": "tc.v14.cache1.c.youtube.com", "url": "http:\\\/\\\/r2---sn-cx1x9-ua8e.c.youtube.com\\\/videoplayback?ratebypass=yes\\u0026source=youtube\\u0026sver=3\\u0026fexp=903903%2C923432%2C924368%2C910207%2C906934%2C916612%2C919515%2C909546%2C929117%2C929121%2C929906%2C929907%2C925720%2C925722%2C925718%2C925714%2C929917%2C929919%2C912521%2C904830%2C919373%2C904122%2C932216%2C908534%2C919387%2C936303%2C909549%2C935006%2C900816%2C936301%2C912711%2C935000%2C921057\\u0026ms=au\\u0026mv=m\\u0026mt=1374658182\\u0026dnc=1\\u0026el=watch\\u0026upn=dChGeGD9MuE\\u0026app=youtube_mobile\\u0026ip=109.67.165.16\\u0026sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire\\u0026id=f5b664a7bab5f5fd\\u0026cp=U0hWSVZTUF9LS0NONl9OTVRIOnNFdUFFYTMyLVU3\\u0026yms=vHvXEy72-S8\\u0026expire=1374682761\\u0026gcr=il\\u0026ipbits=8\\u0026itag=36\\u0026key=yt1\\u0026signature=1F42D2B82E4B25FA7E81629AA88ED24EEA88603A.B93C863A5D423391066F06CC46594505B06A2194"}], "longform": false, "user_image_url": "\\\/\\\/i1.ytimg.com\\\/i\\\/rDkAvwZum-UTjHmzDI2iIw\\\/1.jpg?v=510a2a74", "time_created_text": "15 \\u05d1\\u05d9\\u05d5\\u05dc 2012"}, "allow_comments": true, "subscription_state": {"is_subscribed": false, "show_button": true, "subscribe_url": {"channel_id": "UCrDkAvwZum-UTjHmzDI2iIw", "url": "\\\/channel_post?action_subscribe=1\\u0026feature=watch"}}, "pyv_ping_url": null, "should_prompt_merge_identity": false, "related_videos": [{"related_feature": "fvwrel", "title": "PSY - GENTLEMAN M\\\/V", "duration": "3:54", "watch_link": "\\\/watch?v=ASO_zypdnsQ\\u0026feature=fvwrel", "public_name": "officialpsy", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/ASO_zypdnsQ\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=AaEG9JCQJNWLbT3FGESJqvYSk4g", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 80, "posx": 0, "width": 128, "height": 960}, "view_count": "492,097,571", "encrypted_id": "ASO_zypdnsQ"}, {"related_feature": "fvwrel", "title": "PSY - GENTLEMAN M\\\/V", "duration": "3:54", "watch_link": "\\\/watch?v=ASO_zypdnsQ\\u0026feature=fvwrel", "public_name": "officialpsy", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/ASO_zypdnsQ\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=AaEG9JCQJNWLbT3FGESJqvYSk4g", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 80, "posx": 0, "width": 128, "height": 960}, "view_count": "492,097,571", "encrypted_id": "ASO_zypdnsQ"}, {"related_feature": "relmfu", "title": "PSY (ft. HYUNA) \\uc624\\ube64 \\ub531 \\ub0b4 \\uc2a4\\ud0c0\\uc77c", "duration": "3:47", "watch_link": "\\\/watch?v=wcLNteez3c4\\u0026feature=relmfu", "public_name": "officialpsy", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/wcLNteez3c4\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=bhdemVM8OsWF21SiGRdethcF1FI", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 160, "posx": 0, "width": 128, "height": 960}, "view_count": "390,848,507", "encrypted_id": "wcLNteez3c4"}, {"related_feature": "relmfu", "title": "PSY - GANGNAM STYLE (\\uac15\\ub0a8\\uc2a4\\ud0c0\\uc77c) M\\\/V Making Film", "duration": "8:42", "watch_link": "\\\/watch?v=9HPiBJBCOq8\\u0026feature=relmfu", "public_name": "officialpsy", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/9HPiBJBCOq8\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=L15g9NNG8ymqlQSXM459kAyjcis", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 240, "posx": 0, "width": 128, "height": 960}, "view_count": "59,289,787", "encrypted_id": "9HPiBJBCOq8"}, {"related_feature": "relmfu", "title": "PSY - GANGNAM STYLE (\\uac15\\ub0a8\\uc2a4\\ud0c0\\uc77c) Teaser #2", "duration": "0:24", "watch_link": "\\\/watch?v=o9xDs4ogynk\\u0026feature=relmfu", "public_name": "officialpsy", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/o9xDs4ogynk\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=Z3dmeBopyZ7SpdMxxzPfXZdvrNM", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 320, "posx": 0, "width": 128, "height": 960}, "view_count": "4,032,587", "encrypted_id": "o9xDs4ogynk"}, {"related_feature": "related", "title": "Bumblebee DOTM Revis\\u00e3o em Portugu\\u00eas", "duration": "12:01", "watch_link": "\\\/watch?v=Nkb-NxAwpCM\\u0026feature=related", "public_name": "DinastiaTransformers", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/Nkb-NxAwpCM\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=CCHyK41xpG1GFVUqZuFO-LzQxLY", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 400, "posx": 0, "width": 128, "height": 960}, "view_count": "749,448", "encrypted_id": "Nkb-NxAwpCM"}, {"related_feature": "related", "title": "\\"TuTiTu -- the toys come to life\\"  -  Train", "duration": "3:01", "watch_link": "\\\/watch?v=Pc2hrKhagjY\\u0026feature=related", "public_name": "Twist3DAnimation", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/Pc2hrKhagjY\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=b29GmNVqL6WW4E0UPqpC2sc4Lh0", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 480, "posx": 0, "width": 128, "height": 960}, "view_count": "853,628", "encrypted_id": "Pc2hrKhagjY"}, {"related_feature": "related", "title": "Minecraft: Four Friends. - Ep.1 \\"Diamond Hunters.\\"", "duration": "30:23", "watch_link": "\\\/watch?v=9YsR8dTPAWg\\u0026feature=related", "public_name": "DrDollarGeneral", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/9YsR8dTPAWg\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=PLXTudP8AzQHeLjVR7k1OHweFAQ", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 560, "posx": 0, "width": 128, "height": 960}, "view_count": "930,822", "encrypted_id": "9YsR8dTPAWg"}, {"related_feature": "related", "title": "Mini Baustelle Alsfeld 2011 Part1 HD Video", "duration": "13:28", "watch_link": "\\\/watch?v=mLHXFESIF44\\u0026feature=related", "public_name": "cnc4home", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/mLHXFESIF44\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=h8XHcj31ekICo5V7UlU_A_wBkDM", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 640, "posx": 0, "width": 128, "height": 960}, "view_count": "359,805", "encrypted_id": "mLHXFESIF44"}, {"related_feature": "related", "title": "Angry Birds Space | Ep. 13 | Stuck In Space! (HD)", "duration": "12:13", "watch_link": "\\\/watch?v=iuKSDcXrAg8\\u0026feature=related", "public_name": "ChimneySwift11", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/iuKSDcXrAg8\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=vx8_X9pg4AnUoBPXqIM7MU6woyQ", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 720, "posx": 0, "width": 128, "height": 960}, "view_count": "264,910", "encrypted_id": "iuKSDcXrAg8"}, {"related_feature": "related", "title": "MO' Creatures: Floresta Encantada - Javalis Goblins e muito mais XD", "duration": "42:32", "watch_link": "\\\/watch?v=elBQOqR5TtM\\u0026feature=related", "public_name": "VenomExtreme", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/elBQOqR5TtM\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=LU5ovIhmUxa0-7PpEPHgd-QS3YQ", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 800, "posx": 0, "width": 128, "height": 960}, "view_count": "842,082", "encrypted_id": "elBQOqR5TtM"}, {"related_feature": "related", "title": "New Super Mario Bros. U - Playthrough Part 18", "duration": "17:12", "watch_link": "\\\/watch?v=majhzUsAgbA\\u0026feature=related", "public_name": "Tock46", "thumbnail_for_watch": "http:\\\/\\\/i.ytimg.com\\\/vi\\\/majhzUsAgbA\\\/hqdefault.jpg?w=320\\u0026h=192\\u0026sigh=tVXW6uE8m7JsrFB_s9Gcqi70eeY", "playability": "NO_PREFETCH", "thumbnail_info": {"thumb_height": 72, "thumb_width": 120, "stitched": 1, "url": "http:\\\/\\\/i.ytimg.com\\\/vt?cids=ASO_zypdnsQ,ASO_zypdnsQ,wcLNteez3c4,9HPiBJBCOq8,o9xDs4ogynk,Nkb-NxAwpCM,Pc2hrKhagjY,9YsR8dTPAWg,mLHXFESIF44,iuKSDcXrAg8,elBQOqR5TtM,majhzUsAgbA\\u0026w=120\\u0026h=72\\u0026sigh=W3LGexukRk8vbWOx2fRhYUzW6NM", "posy": 880, "posx": 0, "width": 128, "height": 960}, "view_count": "62,791", "encrypted_id": "majhzUsAgbA"}]}, "build_signature": "iw:900816,903903,904122,904830,906934,908534,909546,909549,910207,912521,912711,916612,919373,919387,919515,921057,923432,924368,925714,925718,925720,925722,929117,929121,929906,929907,929917,929919,932216,935000,935006,936301,936303", "signed_in_username": ""}

我希望用javascript解析它:

function extract(html) {
    var obj = JSON.parse(html);

    return html;
}

如果我删除了解析方法它只返回它,如果我添加它它什么都不返回,所以我理解JSON解析方法出错了。

知道可能是什么问题吗?

4 个答案:

答案 0 :(得分:7)

您应该返回obj而不是html

答案 1 :(得分:5)

我想你想在你的方法中返回obj而不是html;像这样:

function extract(html) {
    var obj = JSON.parse(html);

    return obj;
}

然后再说;如果你考虑一下,你也可以使用JSON.parse(html)而不是编写一个不做任何其他事情的函数,然后包装一个已经存在的函数。

答案 2 :(得分:1)

要添加其他人已经说过的内容,根据jslint.com

,您的JSON无效
Parse error on line 39:
...==\\nPSY CONCERT \\"HAPPENING\\"\\n2013.
-----------------------^
Expecting '}', ':', ',', ']'

我认为JSON.parse部分正在抛出错误,请检查您的控制台。

答案 3 :(得分:1)

function extract(html) {
    var obj = JSON.parse(html);
    return obj;//return obj instead of html
}

没有必要返回原始的json !!!