I have this JSON, which is valid according to JSONbeautify.com :
{
"date_check": "2023-04-05",
"updated_datas": [
{
"FIELD_NAME": "BLN_ADS_LINKS_DETECTED",
"NEW_VALUE": false,
"OLD_VALUE": true
},
{
"FIELD_NAME": "ADS_LINKS_DETECTED",
"NEW_VALUE": null,
"OLD_VALUE": "?"
}
]
}
I'd like to display it in a datatable. I use this function:
Public Function JsonStringToDataTable(ByVal json As String) As DataTable
Dim jsonLinq = JObject.Parse(json)
Dim srcArray = jsonLinq.Descendants().Where(Function(d) TypeOf d Is JArray).First()
Dim trgArray = New JArray()
For Each row As JObject In srcArray.Children(Of JObject)()
Dim cleanRow = New JObject()
For Each column As JProperty In row.Properties()
If TypeOf column.Value Is JValue Then
cleanRow.Add(column.Name, column.Value)
End If
Next
trgArray.Add(cleanRow)
Next
Return JsonConvert.DeserializeObject(Of DataTable)(trgArray.ToString(), New JsonSerializerSettings With {.NullValueHandling = NullValueHandling.Ignore})
End Function
I got this exception:
Error converting value "?" to type 'System.Boolean'. Path '[1].OLD_VALUE', line 10, position 20.
I don't understand: why a boolean?