【发布时间】:2013-10-22 11:54:59
【问题描述】:
我通过 http 接收以下字符串为 json:
Dim json As String = "[{" + """name"":""jocelyne" + """," + """mo"":""jocelyne" + """}" + ",{" + """name"":""eliane" + """," + """mo"":""12345678" + """}" + "]"
我需要将此json数组转换为vb.net中的数据表
我尝试使用 NewtonSoft.json.dll :
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim deserializedProduct As Dictionary(Of String, String) = JsonConvert.DeserializeObject(Of Dictionary(Of String, String))(json)
但我不断收到当前位置没有可用的源代码,尽管我添加了对我的项目的引用并且它在 bin 文件中..
实际错误是:
Cannot deserialize JSON array into type 'System.Collections.Generic.Dictionary`2[System.String,System.String]'.
有没有办法解决这个问题,或者是否有人有另一种方法可以将 json 数组转换为 vb.net 中的数据表?
【问题讨论】:
-
@Shruti json 中有什么不正确的地方?
-
您可以使用此链接jsonlint.org 来验证您的 json
-
@Shruti 我的 json 是有效的 :)
标签: asp.net json vb.net datatable http-post