title: Parsing Foursquare API JSON for Leaflet
body: <p>I'm trying to map a JSON on leaflet pulled from Foursquare, but I'm having a difficult time getting it show.</p>
  
  <p>Here is a working script using a <a href="https://data.cityofnewyork.us/resource/fhrw-4uyv.geojson" rel="nofollow noreferrer">JSON</a> from I've taken from NYC Open Data.</p>
  
  <pre><code>fetch('complaintdata.json')
            .then(function (response) {
              // Read data as JSON
              return response.json();
            })
            .then(function (data) {
              // Create the Leaflet layer for the data
              var complaintData = L.geoJson(data, {
                pointToLayer: function (feature, latlng) {
                  return L.marker(latlng, {icon: myIcon});
                },
  
                onEachFeature: function (feature, layer) {
                  layer.on('click', function () {
                    // This function is called whenever a feature on the layer is clicked
                    console.log(layer.feature.properties);
  
                    // Render the template with all of the properties. Mustache ignores properties
                    // that aren't used in the template, so this is fine.
                    var sidebarContentArea = document.querySelector('.sidebar-content');
                    console.log(sidebarContentArea);
                    sidebarContentArea.innerHTML = Mustache.render(popupTemplate, layer.feature.properties);
                  });
                }
              });
  
              // Add data to the map
              complaintData.addTo(map);
  
            });
  </code></pre>
  
  <p>Here is a <a href="http://jsfiddle.net/g395yw2b" rel="nofollow noreferrer">working example</a> using Google Maps, but I'm having a hard time transferring this over for Leaflet. </p>
  
  <p>Here is the <a href="https://api.foursquare.com/v2/venues/search?near=London&amp;categoryId=4bf58dd8d48988d14c941735&amp;client_id=BOCHQZ4NF0D2NNFP2HM0INIKPUESPUX3RMRDUX02MPWIYSM2&amp;client_secret=EDNX150PKLS4SMRHWL21Q0KLBAQXYQUQV5RAZI0HZSA1IYGG&amp;v=20161111" rel="nofollow noreferrer">JSON</a> I would like to replicate this process for: </p>