I'm trying to get all the name and href values from the json into a data gridview and have gotten stuck. At the moment the gridview remains blank. Any ideas how to fill the gridview?
JSON:
{
"layers": {
"layer": [
{
"name": "tiger:giant_polygon",
"href": "http://localhost:8080/geoserver/rest/layers/tiger%3Agiant_polygon.json"
},
{
"name": "tiger:poi",
"href": "http://localhost:8080/geoserver/rest/layers/tiger%3Apoi.json"
},
{
"name": "tiger:poly_landmarks",
"href": "http://localhost:8080/geoserver/rest/layers/tiger%3Apoly_landmarks.json"
},
{
"name": "tiger:tiger_roads",
"href": "http://localhost:8080/geoserver/rest/layers/tiger%3Atiger_roads.json"
}
]
}
}
Class:
class geoserverLayerName
{
public class Layer
{
public string name { get; set; }
public string href { get; set; }
}
public class Layers
{
public List<Layer> layer { get; set; }
}
public class RootObject
{
public Layers layers { get; set; }
}
}
Deserialize:
private void deserialiseJSON(string strJSON)
{
try
{
var jPerson = JsonConvert.DeserializeObject<Layers>(strJSON);
dgwLayers.DataSource = jPerson.layer;
}
catch(Exception ex)
{
debugOutputJSON("We had a problem: " + ex.Message.ToString());
}
}
This is how I want the gridview to be filled:
Name: Href:
tiger:giant_polygon http://localhost:8080/...
tiger:poi http://localhost:8080/...

List<Layer>in a DataGrid? In this case, please specify the UI fraework you use (WPF, WinForms, ASP.NET).