I am facing an error while converting the JSON data into datatable. For each blank key from JSON which is not having any value is giving me an error while converting it into datatable.
for e.g.
“Vendor Name”: “ABC Suppliers”,
"Invoice Date ": “”,
"Invoice Amount ": “”,
Here, I want to ignore the blank values (Invoice Date & Invoice Amount) while converting the JSON into Datatable. I am attaching the screenshot of the error. Please help me to solve this issue.
please try to inject this code after reading json file
For Each item As JObject In jsonArray
Dim values As Object() = item.Properties().Select(Function(p) p.Value).ToArray()
If Not values.Any(Function(value) value Is Nothing OrElse String.IsNullOrEmpty(value.ToString())) Then
dataTable.Rows.Add(values)
End If
Next
from the screenshots we cannot derive the needed info. Better you share with us a few JSON samples along with the description of the expected output. Thanks
New Input - Copy.json (638 Bytes)
My requirement is, From the given JSON, The first portion of JSON is OK. In the second portion, Some of the field values are coming as blank. I want to convert the JSON into the excel. For the blank values I want to keep column name as it is & its values as blank cell.