converting a namevaluecollection to Json using Json.Net

为君一笑 提交于 2019-12-13 04:19:52

问题


I am a newbie to Json, I have used some examples online and tried to convert a namevaluecollection to a Json (using json.net nuget package) and I only see The Key not the value in my json string after conversion. What am i missing.

 Dim JSONString As String = ""
Dim test As NameValueCollection = New NameValueCollection
                test.Add("1", "One")
                test.Add("2", "Two")
                test.Add("3", "Three")

                JSONString = JsonConvert.SerializeObject(test)

The result in my Json string during runtime is shown in the below screenshot.

Please bear with me I am really new to Json and let alone serialising and deserialising json.


回答1:


Convert NameValueCollection to Dictionary



来源:https://stackoverflow.com/questions/52722950/converting-a-namevaluecollection-to-json-using-json-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!