title: Convert json to datatable vb
body: <p>Good morning,
  today i was trying to convert my json to datatable.</p>
  
  <p>This is what i'm trying to do</p>
  
  <pre><code>    Dim webclient_server7 As New System.Net.WebClient
      Dim json_result As String = webclient_server7.DownloadString("http://myhost/api/mycontroller/GetQuery")
      Dim json_jsonstring = Newtonsoft.Json.JsonConvert.SerializeObject(json_result)
  
      Try
          Dim table As DataTable = JsonConvert.DeserializeObject(Of DataTable)(json_jsonstring)
      Catch ex As Exception
          MsgBox("An exception occured: " &amp; ex.Message)
      End Try
  </code></pre>
  
  <p>And i get an exception saying:<br><br> An exception occured: Unexpected JSON token when reading DataTable. Expected StartArray, got String. Path '', line 1, position 9919.</p>
  
  <p>i validated my json on <a href="http://jsonlint.com/" rel="noreferrer">json lint</a> and it says my json is valid.<br>Is there anyone who can help me fixing this?<br><br>
  here's a copy of my raw json  </p>
  
  <blockquote>
    <p>"{\r\n  \"Table\": [\r\n    {\r\n      \"IdOwner\": \"Davide\",\r\n      \"tag_id\": 1,\r\n      \"tag_type\": \"3\",\r\n      \"tag_group\": \"Group_2\",\r\n      \"tag_name\": \"Alfa\",\r\n      \"tag_sequence\": 123458,\r\n      \"tag_description\": \"Description_2\",\r\n      \"tag_short_descritpion\": \"Desc_2\",\r\n      \"tag_um\": \"kg\",\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": false,\r\n      \"tag_data_edit\": true,\r\n      \"tag_source_name\": \"Alfaservice\",\r\n      \"tag_source_index\": \"Undefined_index\",\r\n      \"tag_source_tagtype\": \"Source_tag_type\",\r\n      \"tag_source_lenght\": 50,\r\n      \"tag_collect_frequency\": 200,\r\n      \"tag_collect_unit\": \"ms\",\r\n      \"tag_low_limit\": 100.0,\r\n      \"tag_high_limit\": 370.0,\r\n      \"tag_control_limit_active\": true,\r\n      \"tag_calc\": \"useless_field\",\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": null\r\n    },\r\n    {\r\n      \"IdOwner\": \"Giuseppe\",\r\n      \"tag_id\": 3,\r\n      \"tag_type\": \"Type_1\",\r\n      \"tag_group\": \"Group_2\",\r\n      \"tag_name\": \"Bemad\",\r\n      \"tag_sequence\": 123456,\r\n      \"tag_description\": \"Description_5\",\r\n      \"tag_short_descritpion\": \"Desc_5\",\r\n      \"tag_um\": \"Kg\",\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": false,\r\n      \"tag_data_edit\": true,\r\n      \"tag_source_name\": \"Alfaservice\",\r\n      \"tag_source_index\": \"Undefined_index\",\r\n      \"tag_source_tagtype\": \"Source_tag_type\",\r\n      \"tag_source_lenght\": 50,\r\n      \"tag_collect_frequency\": 200,\r\n      \"tag_collect_unit\": \"ms\",\r\n      \"tag_low_limit\": 250.0,\r\n      \"tag_high_limit\": 660.0,\r\n      \"tag_control_limit_active\": true,\r\n      \"tag_calc\": \"useless_field\",\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": null\r\n    },\r\n    {\r\n      \"IdOwner\": \"Madalin\",\r\n      \"tag_id\": 2,\r\n      \"tag_type\": \"Type_2\",\r\n      \"tag_group\": \"Group_1\",\r\n      \"tag_name\": \"Bemad\",\r\n      \"tag_sequence\": 123456,\r\n      \"tag_description\": \"Description_1\",\r\n      \"tag_short_descritpion\": \"Desc_1\",\r\n      \"tag_um\": \"Kg\",\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": false,\r\n      \"tag_data_edit\": true,\r\n      \"tag_source_name\": \"Alfaservice\",\r\n      \"tag_source_index\": \"Undefined_index\",\r\n      \"tag_source_tagtype\": \"Source_tag_type\",\r\n      \"tag_source_lenght\": 50,\r\n      \"tag_collect_frequency\": 200,\r\n      \"tag_collect_unit\": \"ms\",\r\n      \"tag_low_limit\": 150.0,\r\n      \"tag_high_limit\": 350.0,\r\n      \"tag_control_limit_active\": true,\r\n      \"tag_calc\": \"useless_field\",\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": null\r\n    },\r\n    {\r\n      \"IdOwner\": \"test\",\r\n      \"tag_id\": 6,\r\n      \"tag_type\": null,\r\n      \"tag_group\": null,\r\n      \"tag_name\": \"REW_SAX_BOWED_ActualVelocity\",\r\n      \"tag_sequence\": 0,\r\n      \"tag_description\": \"1\",\r\n      \"tag_short_descritpion\": \"1\",\r\n      \"tag_um\": null,\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": true,\r\n      \"tag_data_edit\": false,\r\n      \"tag_source_name\": \"REW_SAX_BOWED.ACTUALVELOCITY\",\r\n      \"tag_source_index\": \"0\",\r\n      \"tag_source_tagtype\": \"Float\",\r\n      \"tag_source_lenght\": 0,\r\n      \"tag_collect_frequency\": 100,\r\n      \"tag_collect_unit\": \"1\",\r\n      \"tag_low_limit\": 1.0,\r\n      \"tag_high_limit\": 1.0,\r\n      \"tag_control_limit_active\": false,\r\n      \"tag_calc\": null,\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": null\r\n    },\r\n    {\r\n      \"IdOwner\": \"test\",\r\n      \"tag_id\": 7,\r\n      \"tag_type\": null,\r\n      \"tag_group\": null,\r\n      \"tag_name\": \"REW_SAX_BOWED_ActualVelocity\",\r\n      \"tag_sequence\": 0,\r\n      \"tag_description\": \"1\",\r\n      \"tag_short_descritpion\": \"1\",\r\n      \"tag_um\": null,\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": true,\r\n      \"tag_data_edit\": false,\r\n      \"tag_source_name\": \"REW_SAX_BOWED.ACTUALVELOCITY\",\r\n      \"tag_source_index\": \"0\",\r\n      \"tag_source_tagtype\": \"Float\",\r\n      \"tag_source_lenght\": 0,\r\n      \"tag_collect_frequency\": 100,\r\n      \"tag_collect_unit\": \"1\",\r\n      \"tag_low_limit\": 1.0,\r\n      \"tag_high_limit\": 1.0,\r\n      \"tag_control_limit_active\": false,\r\n      \"tag_calc\": null,\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": \"Tag Name=REW_SAX_BOWED_ActualVelocity,Address=REW_SAX_BOWED.ACTUALVELOCITY,Data Type=Float,Respect Data Type=0,Client Access=RO,Scan Rate=100,Scaling=,Raw Low=,Raw High=,Scaled Low=,Scaled High=,Scaled Data Type=,Clamp Low=,Clamp High=,Eng Units=,Description=,Negate Value=,\"\r\n    },\r\n    {\r\n      \"IdOwner\": \"test\",\r\n      \"tag_id\": 8,\r\n      \"tag_type\": null,\r\n      \"tag_group\": null,\r\n      \"tag_name\": \"REW_SAX_BOWED_ActualVelocity\",\r\n      \"tag_sequence\": 0,\r\n      \"tag_description\": \"1\",\r\n      \"tag_short_descritpion\": \"1\",\r\n      \"tag_um\": null,\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": true,\r\n      \"tag_data_edit\": false,\r\n      \"tag_source_name\": \"REW_SAX_BOWED.ACTUALVELOCITY\",\r\n      \"tag_source_index\": \"0\",\r\n      \"tag_source_tagtype\": \"Float\",\r\n      \"tag_source_lenght\": 0,\r\n      \"tag_collect_frequency\": 100,\r\n      \"tag_collect_unit\": \"1\",\r\n      \"tag_low_limit\": 1.0,\r\n      \"tag_high_limit\": 1.0,\r\n      \"tag_control_limit_active\": false,\r\n      \"tag_calc\": null,\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": \"Tag Name=REW_SAX_BOWED_ActualVelocity,Address=REW_SAX_BOWED.ACTUALVELOCITY,Data Type=Float,Respect Data Type=0,Client Access=RO,Scan Rate=100,Scaling=,Raw Low=,Raw High=,Scaled Low=,Scaled High=,Scaled Data Type=,Clamp Low=,Clamp High=,Eng Units=,Description=,Negate Value=,\"\r\n    },\r\n    {\r\n      \"IdOwner\": \"test\",\r\n      \"tag_id\": 9,\r\n      \"tag_type\": null,\r\n      \"tag_group\": null,\r\n      \"tag_name\": \"REW_SAX_BOWED_ActualVelocity\",\r\n      \"tag_sequence\": 0,\r\n      \"tag_description\": \"1\",\r\n      \"tag_short_descritpion\": \"1\",\r\n      \"tag_um\": null,\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": true,\r\n      \"tag_data_edit\": false,\r\n      \"tag_source_name\": \"REW_SAX_BOWED.ACTUALVELOCITY\",\r\n      \"tag_source_index\": \"0\",\r\n      \"tag_source_tagtype\": \"Float\",\r\n      \"tag_source_lenght\": 0,\r\n      \"tag_collect_frequency\": 100,\r\n      \"tag_collect_unit\": \"1\",\r\n      \"tag_low_limit\": 1.0,\r\n      \"tag_high_limit\": 1.0,\r\n      \"tag_control_limit_active\": false,\r\n      \"tag_calc\": null,\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": \"Tag Name=REW_SAX_BOWED_ActualVelocity,Address=REW_SAX_BOWED.ACTUALVELOCITY,Data Type=Float,Respect Data Type=0,Client Access=RO,Scan Rate=100,Scaling=,Raw Low=,Raw High=,Scaled Low=,Scaled High=,Scaled Data Type=,Clamp Low=,Clamp High=,Eng Units=,Description=,Negate Value=,\"\r\n    },\r\n    {\r\n      \"IdOwner\": \"test\",\r\n      \"tag_id\": 10,\r\n      \"tag_type\": null,\r\n      \"tag_group\": null,\r\n      \"tag_name\": \"REW_SAX_BOWED_ActualVelocity\",\r\n      \"tag_sequence\": 0,\r\n      \"tag_description\": \"1\",\r\n      \"tag_short_descritpion\": \"1\",\r\n      \"tag_um\": null,\r\n      \"tag_active\": true,\r\n      \"tag_collecting\": true,\r\n      \"tag_data_edit\": false,\r\n      \"tag_source_name\": \"REW_SAX_BOWED.ACTUALVELOCITY\",\r\n      \"tag_source_index\": \"0\",\r\n      \"tag_source_tagtype\": \"Float\",\r\n      \"tag_source_lenght\": 0,\r\n      \"tag_collect_frequency\": 100,\r\n      \"tag_collect_unit\": \"1\",\r\n      \"tag_low_limit\": 1.0,\r\n      \"tag_high_limit\": 1.0,\r\n      \"tag_control_limit_active\": false,\r\n      \"tag_calc\": null,\r\n      \"tag_level\": 0,\r\n      \"tag_origine_dati\": \"Tag Name=REW_SAX_BOWED_ActualVelocity,Address=REW_SAX_BOWED.ACTUALVELOCITY,Data Type=Float,Respect Data Type=0,Client Access=RO,Scan Rate=100,Scaling=,Raw Low=,Raw High=,Scaled Low=,Scaled High=,Scaled Data Type=,Clamp Low=,Clamp High=,Eng Units=,Description=,Negate Value=,\"\r\n    }\r\n  ]\r\n}"An exception occured: Unexpected JSON token when reading DataTable. Expected StartArray, got String. Path '', line 1, position 9919.</p>
  </blockquote>