JSON to DataTable gives System.String[]

Hello,

I was trying to Deserialize JSON to DataTable, but I have a problem losing data. My JSON looks like the below:

{
   "data":{
      "city":{
         "street":[
            {
               "id":"1",
               "name":[
                  
               ]
            },
            {
               "id":"2",
               "name":[
                  "A"
               ]
            },
            {
               "id":"36",
               "name":[
                  "A",
                  "B"
               ]
            },
            {
               "id":"4",
               "name":[
                  "A",
                  "B",
                  "C"
               ]
            }
         ]
      }
   }
}

And as DataTable I receives something like that :angry: :

[id,name
1,System.String[]
2,System.String[]
36,System.String[]
4,System.String[]
]

I don’t understand why some data from JSON is messing. I’ve run out of ideas on how to Deserialize JSON such as JOSN :confused:

@Robert_Work

As it contains an internal array so instead deserialize as a JObject and then loop through each and use add data row to create required datatable

cheers

Hi,

Hope the following sample will help you.

Sample20221230-1aL.zip (3.2 KB)

Regards,

1 Like

@Yoichi Thank You! It’s what I needed :magic_wand: :partying_face:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.