title: how to return a Json array after serializing in Asp.Net MVC
body: <p>I have an Action Method that i am using to return GeoJson data using GeoJson.Net. The Action Method is shown below:</p>
  
  <pre><code>public ActionResult GetWorldGeometry()
  {
      var worldgeo = (from w in _bdEntities.worlds1 select w);
      foreach (var w in  worldgeo )
      {
          var world = SqlGeometry.STGeomFromText(new SqlChars(w.geom.AsText()), 4326);
          var worldGeometry = world.ToGeoJSONGeometry();
          var worldFeatureProperties = new Dictionary&lt;string, object&gt;
          {
              {"Name", w.NAME},
              {"Population(05)", w.POP2005},
              {"Region", w.REGION},
              {"ISO2", w.ISO2},
              {"ISO3", w.ISO3},
              {"Area", w.AREA}
          };
          var feature = new Feature(worldGeometry, worldFeatureProperties);
  
          var serializedData = JsonConvert.SerializeObject(feature, Formatting.Indented,
              new JsonSerializerSettings
              {
                  ContractResolver = new CamelCasePropertyNamesContractResolver(),
                  NullValueHandling = NullValueHandling.Ignore
              });
  
          return Content(serializedData, "application/json");
      } 
      return null;
  }
  </code></pre>
  
  <p>On my view, i want to plot this GeoJson to Leaflet or OpenLayers but i am currently testing the output of the Action method using the code below:</p>
  
  <pre><code>        &lt;div&gt;
             &lt;p&gt;
               &lt;span id="add_here"&gt;&lt;/span&gt;
             &lt;/p&gt;
           &lt;/div&gt;
  
           @section scripts
             {
              &lt;script&gt;
                $.ajax({
                    url: '@Url.Action("GetJsonResult", "Home")',
                    dataType: "json", 
                    type: "GET", 
                    contentType: 'application/json; charset=utf-8',
                    cache: false, 
                    data: {}, 
                    traditional: true,
                    success: function(data) {
                    var reslen = data.length;
                    alert(reslen);
                    var result = JSON.stringify(data);
                    alert(result);
                    $('#add_here').text(result);
                         },
                    error: function(xhr) {
                    alert('error');
                         }
                      });
                  &lt;/script&gt;
                 }
  </code></pre>
  
  <p>Instead of getting an array of data, i am jus getting the first result.On alerting the result length, it says "Undefined". How can i get all the data that has been returned by the query in the Action method in my view? Below is a snippet of the single result that is returned and the alert message:
  <a href="http://i.stack.imgur.com/eI6ol.jpg" rel="nofollow">Output results</a></p>