Hi mashispano,
The data returned by the url is an JArray object.
So you can't convert it to DataTable directly.
You need to loop through the JArray object to fetch the value.
Refer below sample code.
Namespaces
C#
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
VB.Net
Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
var json = "[1,[\"R82.5\"],null,[[\"R82.5\",\"Elevated urine levels of drugs, medicaments and biological substances\"]]]";
JArray jsonArray = JsonConvert.DeserializeObject<JArray>(json);
if (jsonArray.Count > 0)
{
foreach (var jVals in jsonArray)
{
if (jVals is JArray)
{
foreach (var jVal in jVals)
{
if (jVal is JArray)
{
foreach (var item in jVal)
{
if ((item as JValue).Value != null)
{
Response.Write((item as JValue).Value + "<br />");
}
}
}
else
{
if ((jVal as JValue).Value != null)
{
Response.Write((jVal as JValue).Value + "<br />");
}
}
}
}
else
{
if ((jVals as JValue).Value != null)
{
Response.Write((jVals as JValue).Value + "<br />");
}
}
}
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim json = "[1,[""R82.5""],null,[[""R82.5"",""Elevated urine levels of drugs, medicaments and biological substances""]]]"
Dim jsonArray As JArray = JsonConvert.DeserializeObject(Of JArray)(json)
If jsonArray.Count > 0 Then
For Each jVals In jsonArray
If TypeOf jVals Is JArray Then
For Each jVal In jVals
If TypeOf jVal Is JArray Then
For Each item In jVal
If (TryCast(item, JValue)).Value IsNot Nothing Then
Response.Write((TryCast(item, JValue)).Value & "<br />")
End If
Next
Else
If (TryCast(jVal, JValue)).Value IsNot Nothing Then
Response.Write((TryCast(jVal, JValue)).Value & "<br />")
End If
End If
Next
Else
If (TryCast(jVals, JValue)).Value IsNot Nothing Then
Response.Write((TryCast(jVals, JValue)).Value & "<br />")
End If
End If
Next
End If
End Sub
Screenshot