My purpose it to create dynamically objects, I cannot have classes because i do not know the properties.
I get from API data about grid fields and columns
("Name":"A", "value": "title 1", "Name":"B", "value": "title 2",).
From other call to API i get the data list
(string list: ["test 1", "test 2"])
And i am creating JObject like:
{"A": "test 1", "B": "Test 2"}.
I want to convert it to be like:
{A: test 1, b = Test 2}
how can i succeed it?
The goal is to have this stucture
public class DataModel
{
public List<BrowserInfoViewModel> Columns { get; set; }
public List<object> Data { get; set; }
}
public class BrowserInfoViewModel
{
public string Header { get; set; }
public string Name { get; set; };
}
And the data somehow to include information similar to BrowserInfoViewModel Name value.
<DxDataGrid CssClass="mw-1100" @ref="grid" Data="@dataObject.Data">
<Columns>
@foreach (var column in dataObject.Columns)
{
<DxDataGridColumn Caption="@column.Header" Field="@column.Name" Width="400px" />
}
</Columns>
Where the property of the object must be same as the column.Name.
If the object data is in that structure
{A: test 1, b = Test 2}
The grid binds data and columns succesfully.
But my JObect that casted to Object returns that way and it fails to show data.
{"A": "test 1", "B": "Test 2"}
>(jsonObject, expConverter);` but are doing `dynamic obj = JsonConvert.DeserializeObject(jsonObject, expConverter);` or vice versa
– Rand Random Mar 10 '21 at 10:33