Advertisement
enissay

Enissay

Jun 10th, 2015
282
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This is a function that has been ported and improved from php
  2. function stripslashes (str) {
  3.   // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
  4.   // +   improved by: Ates Goral (http://magnetiq.com)
  5.   // +      fixed by: Mick@el
  6.   // +   improved by: marrtins
  7.   // +   bugfixed by: Onno Marsman
  8.   // +   improved by: rezna
  9.   // +   input by: Rick Waldron
  10.   // +   reimplemented by: Brett Zamir (http://brett-zamir.me)
  11.   // +   input by: Brant Messenger (http://www.brantmessenger.com/)
  12.   // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
  13.   // *     example 1: stripslashes('Kevin\'s code');
  14.   // *     returns 1: "Kevin's code"
  15.   // *     example 2: stripslashes('Kevin\\\'s code');
  16.   // *     returns 2: "Kevin\'s code"
  17.   return (str + '').replace(/\\(.?)/g, function (s, n1) {
  18.     switch (n1) {
  19.     case '\\':
  20.       return '\\';
  21.     case '0':
  22.       return '\u0000';
  23.     case '':
  24.       return '';
  25.     default:
  26.       return n1;
  27.     }
  28.   });
  29. }
  30.  
  31. 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&center=37.331809997558594,-122.03053283691406&distance=50&access_token=CAAGnZCIivXWYBAOBUkYZBBe1LdtzZB4JQjSF8osOhELmOIzuODf7MsqGTY0VAc6ZAtvVY4cPxef56o498HEMIW1Aha9U5eimZCGd6VC9swJp7ZA2F0zAn6QtU1IlqSDAEETCdwrG6wZB5cSQ0z1n5sENPA4HdxumMzuFNi0HQlWK93ni7bUYsbKmialzVYngJAKaMLb878lAiC40cNgOi92hcprOWFedJos7OgaDlhAZCgZDZD&limit=5000&offset=5000&_after_id=enc_AdDZCPZAxYk3zw1KLypGoq8bRCMsq3b1UFpOhyExmm4UsIRqf9bgEfTbv7uHfZCxlSBjNAvM424ZAv1tmYvhhzJKZAF0p\"}}";
  32.  
  33.  
  34.  
  35. var obj = JSON.parse(stripslashes(result));
  36.  
  37. for (var i = 0; i < obj.data.length; i++) {
  38.     console.log(obj.data[i].name);
  39. }
Advertisement
RAW Paste Data Copied
Advertisement