I need to deserialize the this json returned from grogle maps api:
{
\"destination_addresses\": [
\"Via Medaglie D\'Oro, 10, 47121 Forlì FC, Ital
You should deserialize to classes that match your data. You can generate these classes at http://json2csharp.com/.
// use like
var rootObj = JsonConvert.DeserializeObject(jsonResponse);
foreach (var row in rootObj.rows)
{
foreach (var element in row.elements)
{
Console.WriteLine(element.distance.text);
}
}
// you might want to change the property names to .Net conventions
// use [JsonProperty] to let the serializer know the JSON names where needed
public class Distance
{
public string text { get; set; }
public int value { get; set; }
}
public class Duration
{
public string text { get; set; }
public int value { get; set; }
}
public class Element
{
public Distance distance { get; set; }
public Duration duration { get; set; }
public string status { get; set; }
}
public class Row
{
public List elements { get; set; }
}
public class RootObject
{
public List destination_addresses { get; set; }
public List origin_addresses { get; set; }
public List rows { get; set; }
public string status { get; set; }
}