2017-06-22 3 views
0

私は次のJSONを持っています。NewtonSoft Json 2つのディテールアレイをデシリアライズ

[["NAME","S0101_C01_008EA","S0101_C01_031M","state","county"], 
["Alcona County, Michigan",null,"1.1","26","001"], 
["Alger County, Michigan",null,"1.7","26","003"], 
["Allegan County, Michigan",null,"0.2","26","005"], 
["Alpena County, Michigan",null,"0.9","26","007"], 
["Antrim County, Michigan",null,"0.9","26","009"], 
["Arenac County, Michigan",null,"0.8","26","011"]] 

私はオブジェクトの配列にデシリアライズしようとしています。なぜ私はそんなに苦労しているのか分かりません。

私は必要な情報を入手できます。

Dim PopulationByState As List(Of JArray) = JsonConvert.DeserializeObject(Of List(Of JArray))(response) 

Dim lst As New List(Of String) 'create a new list to hold the strings 

For Each t As JToken In PopulationByState 

    For Each i In t.Children() 

     ListBox1.Items.Add(i) 
    Next 

Next 

誰でもこのことを教えてください。あなたがList(Of List(Of Object))にそれをデシリアライズも事前

+0

あなたはあなたの中に開いている文字列を持っているように見えますコードサンプル。また、問題はどういったものですか? – mmichael

答えて

0

にありがとう:(リストボックスを埋めるのではなく、コンソールに出力付き)

Dim PopulationByState As List(Of List(Of Object)) = _ 
    JsonConvert.DeserializeObject(Of List(Of List(Of Object)))(response) 

Dim state As List(Of Object) 
For Each state In PopulationByState.Skip(1) ' .Skip(1) to skip the header ' 
    ListBox1.Items.Add(String.Join(vbTab, state)) 
Next 

デモ:https://dotnetfiddle.net/XQ3w2Z

関連する問題