Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to iterate through a GeoJSON file (below) and eventually populate an array with a few attributes within "properties". I keep coming up short working through various examples I can find. Do I need to embed another $.each() to get to properties. If it isn't obvious I'm new to this and I've hit the wall.

What I have so far:

$(document).ready(function () {    
            $.getJSON('testpoint.geojson', function (data) {
                var items = [];
                $.each(data.features, function (key, val) {
                    items.push('<li id="' + key + '">' + val + '</li>');
                $('<ul/>', {

And my json is as follows:

    "type": "FeatureCollection",
    "features": [
            "type": "Feature",
            "properties": {
                "gid": 1,
                "PID": "9-18-3",
                "BCT": "BCT126",
                "OWNER_TYPE": "A",
                "LOCNO": 0,
                "LOCEXT": "",
                "STREET": "CROSBY LANE",
                "ACQUIRED": "5/7/2010",
                "GRANTOR": "John A. SPARGO",
                "UPLAND": 0,
                "WETLAND": 3.96,
                "TOTAL": 3.96,
                "HABITAT": "salt marsh"
            "geometry": {
                "type": "Point",
                "coordinates": [
share|improve this question
up vote 6 down vote accepted

You are almost there. Another .each for should work:

$.each(data.features, function (key, val) {
    $.each(, function(i,j){
        items.push('<li id="' + i + '">' + j + '</li>');
share|improve this answer
Thanks Cyrus, that did the trick. I tried every combo but that. I'm a beginner and iterations can become overwhelming quickly – geomajor56 Jul 19 '12 at 19:07

What is written above will loop through each element in each JSON object. Those are JSON objects so you want to treat them as the objects geometry and properties then simply reference them using dot notation.

$.each(data.features, function (key, val) {
  geometry = val.geometry;
  properties =;
  alert (;  
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.