我一直在咀嚼这个两天,但无法使用我找到的样本让它工作。我真的很挣扎 json 解析。
所以我需要做的是将此字符串放入数据表中。我能够达到我有字符串的地步,我只需要解析它。
{"total": 35799, "results": [{"publisher": "bamamatch.com", "first_seen": "2011-08-01", "times_seen": 1598, "monthly_uniques": null, "last_seen": "2013-04-02"}, {"publisher": "catholicdatingforfree.com", "first_seen": "2011-08-01", "times_seen": 1554, "monthly_uniques": null, "last_seen": "2013-04-02"}], "page_size": 100, "offset": 0}
你们能告诉我一种使用VB.net将其解析为数据表的清晰方法吗?
更新
Dim url As String
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
url = "http://api.mixrank.com/v2/json/d73f10e7b22fbc69b79f0e0074913c14/advertisers/" & LCase(txtKeywords.Text) & "/gdn/publishers?page_size=100"
request = DirectCast(WebRequest.Create(url), HttpWebRequest)
response = DirectCast(request.GetResponse(), HttpWebResponse)
reader = New StreamReader(response.GetResponseStream())
Dim myDataTable As DataTable = DirectCast(JsonConvert.DeserializeObject(reader.ReadToEnd, (GetType(DataTable))), DataTable)