How to extract individual elements from a JSON str

2020-04-21 02:02发布

I want to extract the values - Screen Name, Name, ID, Profile Picture URL from the data given below :

[{"id_str":"135977294","description":"4TechCareers is the \u2018insiders\u2019 view of TechCareers.com. Join the Tech job search conversation. @JenGreenfield is the voice for our questions, tips, articles.","follow_request_sent":null,"profile_use_background_image":false,"screen_name":"4TechCareers","status":{"id_str":"15744807225790464","place":null,"coordinates":null,"favorited":false,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"\u003Ca href=\"http:\/\/www.hootsuite.com\" rel=\"nofollow\"\u003EHootSuite\u003C\/a\u003E","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"retweeted":false,"created_at":"Fri Dec 17 12:27:09 +0000 2010","in_reply_to_status_id":null,"geo":null,"in_reply_to_user_id":null,"id":15744807225790464,"truncated":false,"text":"E.U. Deepens Investigation Into Google - European authorities have accepted two additional complaints from Germany, ... http:\/\/ow.ly\/1auOcZ"},"favourites_count":0,"profile_background_color":"1b3859","statuses_count":1215,"profile_background_image_url":"http:\/\/s.twimg.com\/a\/1291661299\/images\/themes\/theme1\/bg.png","url":"http:\/\/www.techcareers.com","listed_count":6,"profile_text_color":"333333","followers_count":238,"location":"","profile_sidebar_fill_color":"f7d35e","lang":"en","verified":false,"profile_background_tile":false,"time_zone":"Quito","created_at":"Thu Apr 22 18:05:29 +0000 2010","protected":false,"friends_count":967,"name":"4TechCareers","is_translator":false,"show_all_inline_media":false,"geo_enabled":false,"profile_link_color":"123a6b","id":135977294,"contributors_enabled":false,"following":null,"notifications":null,"utc_offset":-18000,"profile_sidebar_border_color":"e3bc0c","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/843661363\/TechCareers_bigger_normal.jpg"},{"id_str":"46620750","description":"50% Sharemilker dairy farmer own 550 cows and 400 youngstock and beef, Passion for grass based milk and beef production","follow_request_sent":null,"following":null,"profile_use_background_image":true,"status":{"id_str":"15644729492381696","favorited":false,"created_at":"Fri Dec 17 05:49:28 +0000 2010","place":null,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"web","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"geo":null,"retweeted":false,"in_reply_to_status_id":null,"in_reply_to_user_id":null,"id":15644729492381696,"coordinates":null,"truncated":false,"text":"a cold beer after milking #heven"},"favourites_count":1,"created_at":"Fri Jun 12 09:52:09 +0000 2009","profile_background_color":"0099B9","statuses_count":616,"profile_background_image_url":"http:\/\/s.twimg.com\/a\/1291849542\/images\/themes\/theme4\/bg.gif","listed_count":27,"profile_text_color":"3C3940","followers_count":248,"location":"Rotorua, NewZealand","profile_sidebar_fill_color":"95E8EC","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/259830976\/Picture_1_normal.jpg","verified":false,"profile_background_tile":false,"time_zone":"Auckland","protected":false,"url":null,"notifications":null,"friends_count":425,"screen_name":"NZcows","name":"Colin Grainger-Allen","is_translator":false,"show_all_inline_media":false,"lang":"en","geo_enabled":false,"profile_link_color":"0099B9","id":46620750,"contributors_enabled":false,"utc_offset":43200,"profile_sidebar_border_color":"5ED4DC"},{"id_str":"192008951","description":"mikele","follow_request_sent":false,"following":false,"profile_use_background_image":true,"favourites_count":2,"created_at":"Fri Sep 17 23:14:04 +0000 2010","profile_background_color":"C0DEED","statuses_count":98,"profile_background_image_url":"http:\/\/a3.twimg.com\/a\/1292531900\/images\/themes\/theme1\/bg.png","listed_count":0,"profile_text_color":"333333","followers_count":31,"location":"","profile_sidebar_fill_color":"DDEEF6","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1192406061\/image_normal.jpg","verified":false,"profile_background_tile":false,"time_zone":"Caracas","protected":true,"url":null,"notifications":false,"friends_count":204,"screen_name":"motaola","name":"Miguel Otaola","is_translator":false,"show_all_inline_media":false,"lang":"en","geo_enabled":false,"profile_link_color":"0084B4","id":192008951,"contributors_enabled":false,"utc_offset":-16200,"profile_sidebar_border_color":"C0DEED"},{"id_str":"28670986","description":"Ride like you stole it","follow_request_sent":false,"following":false,"profile_use_background_image":true,"favourites_count":3,"created_at":"Fri Apr 03 22:27:37 +0000 2009","profile_background_color":"EDECE9","statuses_count":55,"profile_background_image_url":"http:\/\/s.twimg.com\/a\/1291163542\/images\/themes\/theme3\/bg.gif","listed_count":0,"profile_text_color":"634047","followers_count":8,"location":"39.0716, -108.5538","profile_sidebar_fill_color":"E3E2DE","profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/422983718\/profile_image_normal.jpg","verified":false,"profile_background_tile":false,"time_zone":"Mountain Time (US & Canada)","protected":true,"url":null,"notifications":false,"friends_count":41,"screen_name":"gneissgranite","name":"Kim Woynowskie","is_translator":false,"show_all_inline_media":false,"lang":"en","geo_enabled":true,"profile_link_color":"088253","id":28670986,"contributors_enabled":false,"utc_offset":-25200,"profile_sidebar_border_color":"D3D2CF"},{"id_str":"19422800","description":"2002 Triumph Bonneville America cruiser. Nine riding seasons, 52k miles. Visit site for more info. Traveled all over the west, US\/Canada. Main acct: @johnbedard","follow_request_sent":null,"profile_use_background_image":true,"screen_name":"FriarsRide","status":{"id_str":"11100646694453248","place":null,"coordinates":null,"favorited":false,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"\u003Ca href=\"http:\/\/twitpic.com\" rel=\"nofollow\"\u003ETwitpic\u003C\/a\u003E","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"retweeted":false,"created_at":"Sat Dec 04 16:52:55 +0000 2010","in_reply_to_status_id":null,"geo":null,"in_reply_to_user_id":null,"id":11100646694453248,"truncated":false,"text":"http:\/\/twitpic.com\/3cvadr"},"favourites_count":1,"profile_background_color":"193219","statuses_count":687,"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/4638094\/mainbg_withURL.png","url":"http:\/\/friarsride.com\/","listed_count":15,"profile_text_color":"193219","followers_count":181,"location":"East Helena, MT","profile_sidebar_fill_color":"00F000","lang":"en","verified":false,"profile_background_tile":true,"time_zone":"Mountain Time (US & Canada)","created_at":"Fri Jan 23 23:46:29 +0000 2009","protected":false,"friends_count":173,"name":"Friar John Bedard","is_translator":false,"show_all_inline_media":false,"geo_enabled":false,"profile_link_color":"193219","id":19422800,"contributors_enabled":false,"following":null,"notifications":null,"utc_offset":-25200,"profile_sidebar_border_color":"CCEECC","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/83600156\/bulldoglogo_normal.jpg"},{"id_str":"15765439","description":"Curmudgeon in Training. Social retard. Motorcyclist. Nerd. Web Designer. Heretic. If something upsets you I will probably make a joke about it.","follow_request_sent":false,"following":false,"profile_use_background_image":true,"status":{"id_str":"15601779836190720","favorited":false,"created_at":"Fri Dec 17 02:58:48 +0000 2010","place":null,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"\u003Ca href=\"http:\/\/www.tweetdeck.com\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"geo":null,"retweeted":false,"in_reply_to_status_id":null,"in_reply_to_user_id":null,"id":15601779836190720,"coordinates":null,"truncated":false,"text":"I'm bookended by ninkompoops."},"favourites_count":118,"created_at":"Thu Aug 07 16:33:30 +0000 2008","profile_background_color":"000000","statuses_count":4775,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/4638253\/background_temp.png","listed_count":22,"profile_text_color":"333333","followers_count":326,"location":"East Helena, MT","profile_sidebar_fill_color":"cccccc","profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1084100038\/twitter_kootenay2010_normal.jpg","verified":false,"profile_background_tile":false,"time_zone":"Mountain Time (US & Canada)","protected":false,"url":"http:\/\/www.johnbedard.com\/","notifications":false,"friends_count":462,"screen_name":"johnbedard","name":"John Bedard","is_translator":false,"show_all_inline_media":false,"lang":"en","geo_enabled":false,"profile_link_color":"0000cc","id":15765439,"contributors_enabled":false,"utc_offset":-25200,"profile_sidebar_border_color":"ffffff"},{"verified":false,"created_at":"Mon Jul 20 12:56:13 +0000 2009","description":"Taurofecundian... I can smell bullshit a mile away!","friends_count":90,"profile_link_color":"0099B9","status":{"retweeted":false,"created_at":"Wed Dec 15 02:11:12 +0000 2010","place":null,"id_str":"14865021980901376","truncated":false,"source":"web","geo":null,"favorited":false,"in_reply_to_status_id":null,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"coordinates":null,"in_reply_to_user_id":null,"contributors":null,"retweet_count":0,"id":14865021980901376,"in_reply_to_user_id_str":null,"text":"#flyers #penguins VS. announcers suck.Painful. Oh well, time to watch the #leafs #oilers with a \"play by play\" guy who ACTUALLY knows hockey"},"is_translator":false,"show_all_inline_media":false,"geo_enabled":false,"profile_sidebar_border_color":"5ED4DC","id_str":"58466091","contributors_enabled":false,"location":"Toronto","profile_use_background_image":true,"followers_count":43,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1176803386\/avatar-head_other_normal.png","follow_request_sent":false,"profile_background_color":"000000","url":null,"notifications":false,"profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/24555296\/avatar-Pic.jpg","favourites_count":0,"screen_name":"Technoguppy","lang":"en","statuses_count":288,"protected":false,"profile_text_color":"3C3940","name":"Scott Moses","listed_count":0,"profile_sidebar_fill_color":"95E8EC","id":58466091,"following":false,"profile_background_tile":false,"time_zone":"Eastern Time (US & Canada)","utc_offset":-18000},{"id_str":"24335079","description":"I'm just a comic living the dream...I think","follow_request_sent":false,"following":false,"profile_use_background_image":true,"status":{"id_str":"15415675522654208","favorited":false,"created_at":"Thu Dec 16 14:39:18 +0000 2010","place":null,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"\u003Ca href=\"http:\/\/www.tweetdeck.com\" rel=\"nofollow\"\u003ETweetDeck\u003C\/a\u003E","contributors":null,"retweet_count":1,"in_reply_to_user_id_str":null,"geo":null,"retweeted":false,"in_reply_to_status_id":null,"in_reply_to_user_id":null,"id":15415675522654208,"coordinates":null,"truncated":false,"text":"O The weather outside is frightful so come see Alonzo Bodden at Gothams comedy club in manhattan.  Ok it's not frightful but it's cold"},"favourites_count":2,"created_at":"Sat Mar 14 05:24:34 +0000 2009","profile_background_color":"ffffff","statuses_count":1195,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/131428733\/AB-Twitter_1_.jpg","listed_count":123,"profile_text_color":"292929","followers_count":1749,"location":"Los Angeles","profile_sidebar_fill_color":"b8c5db","profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/221957693\/Bodden__Alonzo-3933_normal.jpg","verified":true,"profile_background_tile":false,"time_zone":"Pacific Time (US & Canada)","protected":false,"url":"http:\/\/alonzolive.com\/","notifications":false,"friends_count":208,"screen_name":"AlonzoBodden","name":"Alonzo Bodden","is_translator":false,"show_all_inline_media":false,"lang":"en","geo_enabled":false,"profile_link_color":"4357a8","id":24335079,"contributors_enabled":false,"utc_offset":-28800,"profile_sidebar_border_color":"3b768c"},{"id_str":"111160380","description":"Hi' all....\r\njust One big Mal-FUNction Here....\r\nthat's me... you'll WILL GET OVER IT..!!!\r\nHA.HA.","follow_request_sent":null,"profile_use_background_image":true,"screen_name":"MalFUNctions65","status":{"id_str":"9325019568","place":null,"coordinates":null,"favorited":false,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"web","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"retweeted":false,"created_at":"Fri Feb 19 07:29:59 +0000 2010","in_reply_to_status_id":null,"geo":null,"in_reply_to_user_id":null,"id":9325019568,"truncated":false,"text":"Hey, People. if you want to talk about  programs and homework, if i can help???\ncontact me- malcolm.padley@yahoo.com.au \n0406-158-704.cya"},"favourites_count":0,"profile_background_color":"1A1B1F","statuses_count":5,"profile_background_image_url":"http:\/\/s.twimg.com\/a\/1291760612\/images\/themes\/theme9\/bg.gif","url":null,"listed_count":0,"profile_text_color":"666666","followers_count":6,"location":"shepparton","profile_sidebar_fill_color":"252429","lang":"en","verified":false,"profile_background_tile":false,"time_zone":"Melbourne","created_at":"Thu Feb 04 00:27:38 +0000 2010","protected":false,"friends_count":20,"name":"malcolm padley","is_translator":false,"show_all_inline_media":false,"geo_enabled":false,"profile_link_color":"2FC2EF","id":111160380,"contributors_enabled":false,"following":null,"notifications":null,"utc_offset":36000,"profile_sidebar_border_color":"181A1E","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/674352579\/Photo_3_normal.jpg"},{"listed_count":2,"profile_link_color":"0084B4","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/472314123\/robert_ill_fu_1280_normal.gif","status":{"in_reply_to_status_id_str":null,"place":null,"contributors":null,"retweet_count":0,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"geo":null,"id_str":"25436106571","retweeted":false,"source":"\u003Ca href=\"http:\/\/icountit.blogspot.com\/\" rel=\"nofollow\"\u003EBeer Counter - Android\u003C\/a\u003E","coordinates":null,"in_reply_to_status_id":null,"truncated":false,"text":"I'm drinking beer number 1. Cheers!","favorited":false,"id":25436106571,"in_reply_to_screen_name":null,"created_at":"Fri Sep 24 20:26:16 +0000 2010"},"profile_sidebar_border_color":"a8c7f7","location":"Sweden","id_str":"80782811","verified":false,"notifications":false,"screen_name":"2300cc","profile_use_background_image":true,"friends_count":48,"url":"http:\/\/www.r3owners.se","is_translator":false,"show_all_inline_media":false,"geo_enabled":false,"profile_background_color":"022330","contributors_enabled":false,"lang":"en","profile_background_image_url":"http:\/\/a1.twimg.com\/profile_background_images\/55907222\/robert_ill_fu_1280.gif","protected":false,"follow_request_sent":false,"profile_text_color":"333333","followers_count":49,"description":"Administrator and  Motorcyclist Extraordinaire.","name":"Rocket","following":false,"favourites_count":0,"profile_sidebar_fill_color":"C0DFEC","id":80782811,"statuses_count":154,"profile_background_tile":false,"time_zone":"Stockholm","utc_offset":3600,"created_at":"Thu Oct 08 06:26:20 +0000 2009"},{"id_str":"15607075","description":"Englishman in NY.  Work in licensing photography.","follow_request_sent":null,"profile_use_background_image":true,"screen_name":"greerso","status":{"id_str":"26367153434","place":null,"coordinates":null,"favorited":false,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"\u003Ca href=\"http:\/\/twitter.com\" rel=\"nofollow\"\u003ETweetie for Mac\u003C\/a\u003E","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"retweeted":false,"created_at":"Mon Oct 04 14:30:30 +0000 2010","in_reply_to_status_id":null,"geo":null,"in_reply_to_user_id":null,"id":26367153434,"truncated":false,"text":"Michael Muller joins CPi Syndication - http:\/\/eepurl.com\/bbomY (via @cpisyndication)"},"favourites_count":2,"profile_background_color":"1A1B1F","statuses_count":2,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/3783977\/birdjack.jpg","url":"http:\/\/cpi-syndication.com","listed_count":0,"profile_text_color":"666666","followers_count":19,"location":"Port Wasthington, NY","profile_sidebar_fill_color":"252429","lang":"en","verified":false,"profile_background_tile":false,"time_zone":"Eastern Time (US & Canada)","created_at":"Sat Jul 26 03:10:39 +0000 2008","protected":false,"friends_count":88,"name":"Danny Greer","is_translator":false,"show_all_inline_media":false,"geo_enabled":false,"profile_link_color":"2FC2EF","id":15607075,"contributors_enabled":false,"following":null,"notifications":null,"utc_offset":-18000,"profile_sidebar_border_color":"181A1E","profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/69643823\/IMG_1284_2_normal.JPG"},{"id_str":"149842397","description":null,"follow_request_sent":null,"profile_use_background_image":true,"screen_name":"Rocketpockets05","status":{"id_str":"19065366435","place":null,"coordinates":null,"favorited":false,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"\u003Ca href=\"http:\/\/twitter.com\/devices\" rel=\"nofollow\"\u003Etxt\u003C\/a\u003E","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"retweeted":false,"created_at":"Wed Jul 21 10:00:54 +0000 2010","in_reply_to_status_id":null,"geo":null,"in_reply_to_user_id":null,"id":19065366435,"truncated":false,"text":"Saw some on ebay yesterday."},"favourites_count":0,"profile_background_color":"C0DEED","statuses_count":3,"profile_background_image_url":"http:\/\/s.twimg.com\/a\/1292022067\/images\/themes\/theme1\/bg.png","url":null,"listed_count":0,"profile_text_color":"333333","followers_count":0,"location":null,"profile_sidebar_fill_color":"DDEEF6","lang":"en","verified":false,"profile_background_tile":false,"time_zone":null,"created_at":"Sun May 30 11:04:23 +0000 2010","protected":false,"friends_count":1,"name":"Mysteriously Unnamed","is_translator":false,"show_all_inline_media":false,"geo_enabled":false,"profile_link_color":"0084B4","id":149842397,"contributors_enabled":false,"following":null,"notifications":null,"utc_offset":null,"profile_sidebar_border_color":"C0DEED","profile_image_url":"http:\/\/s.twimg.com\/a\/1292022067\/images\/default_profile_5_normal.png"},{"id_str":"22678224","description":"","follow_request_sent":null,"profile_use_background_image":true,"screen_name":"timothyfrazier","status":{"id_str":"13703936758251520","place":{"url":"http:\/\/api.twitter.com\/1\/geo\/id\/1086ea542f51a2ea.json","attributes":{"street_address":"201 Interstate 20 E"},"full_name":"BJ's Restaurant & Brewhouse, Arlington","country":"United States","name":"BJ's Restaurant & Brewhouse","place_type":"poi","country_code":"US","id":"1086ea542f51a2ea","bounding_box":{"type":"Polygon","coordinates":[[[-97.110405,32.678838],[-97.110405,32.678838],[-97.110405,32.678838],[-97.110405,32.678838]]]}},"coordinates":{"type":"Point","coordinates":[-97.11021423,32.67955156]},"favorited":false,"in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"source":"\u003Ca href=\"http:\/\/foursquare.com\" rel=\"nofollow\"\u003Efoursquare\u003C\/a\u003E","contributors":null,"retweet_count":0,"in_reply_to_user_id_str":null,"retweeted":false,"created_at":"Sat Dec 11 21:17:27 +0000 2010","in_reply_to_status_id":null,"geo":{"type":"Point","coordinates":[32.67955156,-97.11021423]},"in_reply_to_user_id":null,"id":13703936758251520,"truncated":false,"text":"I'm at BJ's Restaurant & Brewhouse (201 Interstate 20 E, Matlock Rd, Arlington) w\/ 2 others. http:\/\/4sq.com\/dijXyx"},"favourites_count":0,"profile_background_color":"C0DEED","statuses_count":78,"profile_background_image_url":"http:\/\/s.twimg.com\/a\/1291318259\/images\/themes\/theme1\/bg.png","url":null,"listed_count":0,"profile_text_color":"333333","followers_count":7,"location":"Grapevine, Texas","profile_sidebar_fill_color":"DDEEF6","lang":"en","verified":false,"profile_background_tile":false,"time_zone":"Central Time (US & Canada)","created_at":"Tue Mar 03 20:57:36 +0000 2009","protected":false,"friends_count":5,"name":"Timothy Frazier","is_translator":false,"show_all_inline_media":true,"geo_enabled":true,"profile_link_color":"0084B4","id":22678224,"contributors_enabled":false}]

What is a fast and working preg pattern to extract values from above data?

标签: php regex json
1条回答
够拽才男人
2楼-- · 2020-04-21 02:51

Your data is in JSON format. You can use json_decode() to convert it to a PHP array.

查看更多
登录 后发表回答