【发布时间】:2013-10-17 11:28:30
【问题描述】:
我有来自 http 帖子的以下 json 字符串:
Dim json As String = "{" + """contacts"":" + "[{" + """name"":""jocelyne" + """," + """mo"":""jocelyne" + """}" + ",{" + """name"":""eliane" + """," + """mo"":""12345678" + """}" + "]}"
如何反序列化这个 json 数组?我尝试使用字典,但它不起作用 注意json数组的长度可能很大
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer()
Dim dict As Dictionary(Of String, String) = jss.Deserialize(Of Dictionary(Of String, String))(json)
For Each item As KeyValuePair(Of String, String) In dict
Response.Write(item.Key & " - " & item.Value & "<br>")
Next
【问题讨论】:
-
将其反序列化为自定义对象可能更好? stackoverflow.com/questions/9586585/…
标签: asp.net arrays json vb.net http-post