title: GeoJson c# example parse countries in the world and generate Geojson for each country
body: <p>Looking for an example of how to parse / deserialize  Geojson files using geojson.net. for some reason there are no examples of how to use the geojson.net package.</p>
  
  <p>I would like to use this on my site with the google maps api. currently I use polygon shapes but want to move towards using geojson objects for the layers as this seems to be a better format.</p>
  
  <p>using c# I would like to serialize Geojson, select specific country borders and generate a new geojson file that can be references and added to google maps as a layer.</p>
  
  <p>to test this I created a colsole app to try to deserilaize the GeoJson, this does not work (please could you give me some direction on the correct way to deserialize Geojson ?)</p>
  
  <pre><code>        static void Main(string[] args)
      {
          string Jsonstring = File.ReadAllText("c:/worldborders.json");
          JavaScriptSerializer ser = new JavaScriptSerializer();
          List&lt;GeoJsonProperties&gt; ns = (List&lt;GeoJsonProperties&gt;)ser.Deserialize(Jsonstring, typeof(List&lt;GeoJsonProperties&gt;));
  
  ?ns is Empty?
  
  
      }
  </code></pre>
  
  <p>I created a class for the geojson file using the online generator  <a href="http://json2csharp.com/" rel="nofollow">http://json2csharp.com/</a> (I had thought that GeoJson.net would include the class as its a standard) ,      GeoJsonProperties, </p>
  
  <pre><code> public class GeoJsonProperties
  {
      public int scalerank { get; set; }
      public string featurecla { get; set; }
      public double labelrank { get; set; }
      public string sovereignt { get; set; }
      public string sov_a3 { get; set; }
      public double adm0_dif { get; set; }
      public double level { get; set; }
      public string type { get; set; }
      public string admin { get; set; }
      public string adm0_a3 { get; set; }
      public double geou_dif { get; set; }
      public string geounit { get; set; }
      public string gu_a3 { get; set; }
      public double su_dif { get; set; }
      public string subunit { get; set; }
      public string su_a3 { get; set; }
      public double brk_diff { get; set; }
      public string name { get; set; }
      public string name_long { get; set; }
      public string brk_a3 { get; set; }
      public string brk_name { get; set; }
      public object brk_group { get; set; }
      public string abbrev { get; set; }
      public string postal { get; set; }
      public string formal_en { get; set; }
      public string formal_fr { get; set; }
      public string note_adm0 { get; set; }
      public string note_brk { get; set; }
      public string name_sort { get; set; }
      public string name_alt { get; set; }
      public double mapcolor7 { get; set; }
      public double mapcolor8 { get; set; }
      public double mapcolor9 { get; set; }
      public double mapcolor13 { get; set; }
      public double pop_est { get; set; }
      public double gdp_md_est { get; set; }
      public double pop_year { get; set; }
      public double lastcensus { get; set; }
      public double gdp_year { get; set; }
      public string economy { get; set; }
      public string income_grp { get; set; }
      public double wikipedia { get; set; }
      public object fips_10 { get; set; }
      public string iso_a2 { get; set; }
      public string iso_a3 { get; set; }
      public string iso_n3 { get; set; }
      public string un_a3 { get; set; }
      public string wb_a2 { get; set; }
      public string wb_a3 { get; set; }
      public double woe_id { get; set; }
      public string adm0_a3_is { get; set; }
      public string adm0_a3_us { get; set; }
      public double adm0_a3_un { get; set; }
      public double adm0_a3_wb { get; set; }
      public string continent { get; set; }
      public string region_un { get; set; }
      public string subregion { get; set; }
      public string region_wb { get; set; }
      public double name_len { get; set; }
      public double long_len { get; set; }
      public double abbrev_len { get; set; }
      public double tiny { get; set; }
      public double homepart { get; set; }
  }
  
  public class Geometry
  {
      public string type { get; set; }
      public List&lt;List&lt;List&lt;object&gt;&gt;&gt; coordinates { get; set; }
  }
  
  public class Feature
  {
      public string type { get; set; }
      public GeoJsonProperties  properties { get; set; }
      public Geometry geometry { get; set; }
  }
  
  public class RootObject
  {
      public string type { get; set; }
      public List&lt;Feature&gt; features { get; set; }
  }
  </code></pre>
  
  <p>}</p>