0

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. Runtime Value of my Json String

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

Abe
  • 1,879
  • 2
  • 24
  • 39
  • 1
    See [ArgumentNullException in Json.NET 6.0.7 when deserializing into NameValueCollection](https://stackoverflow.com/q/27828350/3744182) and [how to convert NameValueCollection to JSON string?](https://stackoverflow.com/q/7003740). Are those sufficient or do you need those answers translated into vb.net? – dbc Oct 09 '18 at 14:18
  • @dbc Thanks for the comment I have gone through First Link and Second link. First link is more useful than the second. However, the first link does not help me as the values are not getting stripped but they are not showing altogether. Yes a simple vb.net code will greatly help. – Abe Oct 09 '18 at 14:32
  • *However, the first link does not help me as the values are not getting stripped but they are not showing altogether.* - does that mean you tried implementing the first link and it failed, or that you didn't try implementing the first link? – dbc Oct 09 '18 at 14:51

1 Answers1

0

Convert NameValueCollection to Dictionary

smolchanovsky
  • 1,775
  • 2
  • 15
  • 29