title: JSON.NET get specific items from string
body: <p>I have a string called rawJsonPostCodeString that looks like the following    JSON. </p>
  
  <pre><code>{
      "status": 200,
      "result": {
          "postcode": "SW1A 1AA",
          "quality": 1,
          "eastings": 529090,
          "northings": 179645,
          "country": "England",
          "nhs_ha": "London",
          "longitude": -0.141588,
          "latitude": 51.501009,
          "european_electoral_region": "London",
          "primary_care_trust": "Westminster",
          "region": "London",
          "lsoa": "Westminster 018C",
          "msoa": "Westminster 018",
          "incode": "1AA",
          "outcode": "SW1A",
          "parliamentary_constituency": "Cities of London and Westminster",
          "admin_district": "Westminster",
          "parish": "Westminster, unparished area",
          "admin_county": null,
          "admin_ward": "St James's",
          "ced": null,
          "ccg": "NHS Central London (Westminster)",
          "nuts": "Westminster",
          "codes": {
              "admin_district": "E09000033",
              "admin_county": "E99999999",
              "admin_ward": "E05000644",
              "parish": "E43000236",
              "parliamentary_constituency": "E14000639",
              "ccg": "E38000031",
              "ced": "E99999999",
              "nuts": "UKI32"
          }
      }
  }
  </code></pre>
  
  <p>I also have a class called <code>PostCodeLocation</code> that looks like the below: </p>
  
  <pre><code>class PostCodeLocation
  {        
      public double longitude { get; set; }
      public double latitude { get; set; }
  }
  </code></pre>
  
  <p>I have been using Json.Net to parse this data and then assign it to two items in the class. </p>
  
  <p>Previously I have been using a code like the below to fetch data from a list with multiple results but when I try adapting this to read from my JSON for the post codes it throws an error on the JArray.Parse line for the format being invalid. I have not done any work with JSON before so I am unsure of the best way to process it.</p>
  
  <pre><code>  public List&lt;PostCodeLocation&gt; ProcessJSONPostCodeLocation(string JSonPostCodes)
      {
          JArray PCDetails = JArray.Parse(JSonPostCodes);
          List&lt;JToken&gt; results = PCDetails.Children().ToList();
          List&lt;PostCodeLocaton&gt; PCResults = new List&lt;PostCodeLocation&gt;();
          foreach (JToken result in results)
          {
              PCResults.Add(result.ToObject&lt;PostCodeLocation&gt;());
          }
          return PCResults;
      }
  </code></pre>
  
  <p>If anyone has any tips it would be greatly appreciated. </p>