DataGrid - Pass value from JSON

I am getting, from a REST API (GET method), a list of objects ( IList ) like this one:

 {
    "id": 1,
    "location": {
      "coordinates": [
        2,
        2,
        2
      ],
      "type": "point"
    },
    "name": "TEST",
    "type": "TEST"
  }

I use this REST API as Data source for my Radzen Grid. All properties are displayed normally except the coordinates.

e.g. for the first element of the coordinates, I used this line of code:
<RadzenGridColumn Width="200px" TItem="Robot" Property="location.coordinates[0]" Title="Coordinates">
but the value is not displayed. Instead, the name of the class is returned.

The definition of the class Robot is the following:

            public partial class Robot
            {
                [JsonProperty("id")]
                public int? id { get; set; }

                [JsonProperty("location")]
                public Location location { get; set; }

                [JsonProperty("name")]
                public string name { get; set; }

                [JsonProperty("type")]
                public string type { get; set; }
            }

            public partial class Location
            {
                [JsonProperty("coordinates")]
                public double[] coordinates { get; set; }
                
                [JsonProperty("type")]
                public string type { get; set; }
            }

Hi @mmichael,

The RadzenGrid does not recognize this expression because it isn't a property name. Try with the Template of the column:

<RadzenGridColumn Width="200px" TItem="Robot" Title="Coordinates">
 <Template Context="data">
    @data.location.coordinates[0]
 </Template>
</RadzenGridColumn>
1 Like

This works fine. Thank you very much for the instant reply!