Multidimensional Json Array to Datatable

Hi Experts

I have a multidimensional Json array that looks like the example below:

{
“JsonArray”: [
{
“Category”: “Cat1”,
“Description”: “Item category 1”
},
{
“Category”: “Cat2”,
“Description”: “Item category 2”
},
{
“Category”: “Cat3”,
“Description”: “Item category 3”
}
]
}

I need to convert this into a datatable that will end up with two columns named Category and Description.

The catch is that there will be other multidimensional arrays too with other key field names so the datatable column names should be set dynamically rather than hard coded. However each array should be populated into it’s own datatable.

So far I have managed to deserialize the input string to a Json array - my idea was then to loop through each child of the first entry in the Json array (something like myJsonArray(0).Children). But I do not know how to extract the “key field” names nor the values.

I have been looking through a lot of articles in the forum but cannot seem to find a solution.

Any ideas?

Hello,

Did you try this?

Cheers,
Radomir