Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a function that has been ported and improved from php
- function stripslashes (str) {
- // + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
- // + improved by: Ates Goral (http://magnetiq.com)
- // + fixed by: Mick@el
- // + improved by: marrtins
- // + bugfixed by: Onno Marsman
- // + improved by: rezna
- // + input by: Rick Waldron
- // + reimplemented by: Brett Zamir (http://brett-zamir.me)
- // + input by: Brant Messenger (http://www.brantmessenger.com/)
- // + bugfixed by: Brett Zamir (http://brett-zamir.me)
- // * example 1: stripslashes('Kevin\'s code');
- // * returns 1: "Kevin's code"
- // * example 2: stripslashes('Kevin\\\'s code');
- // * returns 2: "Kevin\'s code"
- return (str + '').replace(/\\(.?)/g, function (s, n1) {
- switch (n1) {
- case '\\':
- return '\\';
- case '0':
- return '\u0000';
- case '':
- return '';
- default:
- return n1;
- }
- });
- }
- var result = "{\"data\":[{\"name\":\"Apple Campus\",\"id\":\"142958362381575\",\"category\":\"Landmark\",\"categorylist\":[{\"id\":\"209889829023118\",\"name\":\"Landmark\"},{\"id\":\"139823692748565\",\"name\":\"Computers & Electronics\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014-2083\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop, Cupertino, CA 95014\"}},{\"name\":\"Misenplace\",\"id\":\"193287204199495\",\"category\":\"Restaurant\/cafe\",\"category_list\":[{\"id\":\"139433292785470\",\"name\":\"Caterer\"},{\"id\":\"176527262444235\",\"name\":\"Farmers Market\"},{\"id\":\"197871390225897\",\"name\":\"Cafe\"}],\"location\":{\"city\":\"Mountain House\",\"state\":\"CA\",\"zip\":\"95391\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"\"}},{\"name\":\"1 Infinite Loop\",\"id\":\"158535820858541\",\"category\":\"Local business\",\"category_list\":[{\"id\":\"139823692748565\",\"name\":\"Computers & Electronics\"},{\"id\":\"177721448951559\",\"name\":\"Workplace & Office\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331688220724,\"longitude\":-122.0305083303,\"street\":\"1 Infinite Loop\"}},{\"name\":\"Apple\",\"id\":\"294500050617071\",\"category\":\"Computers\/technology\",\"category_list\":[{\"id\":\"2255\",\"name\":\"Computers\/Technology\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop\"}},{\"name\":\"iTunes\",\"id\":\"149398551864065\",\"category\":\"Local business\",\"category_list\":[{\"id\":\"396255327112122\",\"name\":\"Music Store\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop\"}},{\"name\":\"ShizZo Design\",\"id\":\"1534516756820601\",\"category\":\"Organization\",\"category_list\":[{\"id\":\"2600\",\"name\":\"Organization\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop\"}},{\"name\":\"Apple Store\",\"id\":\"239236252799721\",\"category\":\"Computers\/technology\",\"category_list\":[{\"id\":\"2255\",\"name\":\"Computers\/Technology\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop\"}},{\"name\":\"Game Center\",\"id\":\"102634949791855\",\"category\":\"Landmark\",\"category_list\":[{\"id\":\"139823692748565\",\"name\":\"Computers & Electronics\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"\",\"country\":\"United States\",\"latitude\":37.331666666667,\"longitude\":-122.03083333333,\"street\":\"\"}},{\"name\":\"Appleunlockstore.com\",\"id\":\"505045622933427\",\"category\":\"Professional services\",\"category_list\":[{\"id\":\"152142351517013\",\"name\":\"Corporate Office\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop\"}},{\"name\":\"Fans of Apple Inc\",\"id\":\"609543565739832\",\"category\":\"Landmark\",\"category_list\":[{\"id\":\"209889829023118\",\"name\":\"Landmark\"}],\"location\":{\"city\":\"Los Angeles\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop Cupertino, California 95014\"}},{\"name\":\"Apple Lovers\",\"id\":\"431767373548944\",\"category\":\"Computers\/technology\",\"category_list\":[{\"id\":\"2255\",\"name\":\"Computers\/Technology\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop \"}},{\"name\":\"UTechnologies Ltd - By U&U Inc\",\"id\":\"356462431119486\",\"category\":\"Computers\/technology\",\"category_list\":[{\"id\":\"108472109230615\",\"name\":\"Computer Services\"},{\"id\":\"199512783398620\",\"name\":\"Computer Store\"},{\"id\":\"162237190493977\",\"name\":\"Computer Training\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"95014\",\"country\":\"United States\",\"latitude\":37.331845,\"longitude\":-122.030212,\"street\":\"1 Infinite Loop\"}},{\"name\":\"Mac App Store - Apple 68\",\"id\":\"299396923548735\",\"category\":\"Consulting\/business services\",\"category_list\":[{\"id\":\"2248\",\"name\":\"Consulting\/Business Services\"}],\"location\":{\"city\":\"Cupertino\",\"state\":\"CA\",\"zip\":\"\",\"country\":\"United States\",\"latitude\":37.33161336436,\"longitude\":-122.0306938325,\"street\":\"\"}}],\"paging\":{\"next\":\"https:\/\/graph.facebook.com\/v2.2\/search?type=place&format=json¢er=37.331809997558594,-122.03053283691406&distance=50&access_token=CAAGnZCIivXWYBAOBUkYZBBe1LdtzZB4JQjSF8osOhELmOIzuODf7MsqGTY0VAc6ZAtvVY4cPxef56o498HEMIW1Aha9U5eimZCGd6VC9swJp7ZA2F0zAn6QtU1IlqSDAEETCdwrG6wZB5cSQ0z1n5sENPA4HdxumMzuFNi0HQlWK93ni7bUYsbKmialzVYngJAKaMLb878lAiC40cNgOi92hcprOWFedJos7OgaDlhAZCgZDZD&limit=5000&offset=5000&_after_id=enc_AdDZCPZAxYk3zw1KLypGoq8bRCMsq3b1UFpOhyExmm4UsIRqf9bgEfTbv7uHfZCxlSBjNAvM424ZAv1tmYvhhzJKZAF0p\"}}";
- var obj = JSON.parse(stripslashes(result));
- for (var i = 0; i < obj.data.length; i++) {
- console.log(obj.data[i].name);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement