Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, July 13, 2012 2:18 AM
Hello I'm trying to deserialise a JSON response in vb.net and put it in a dictionary.
The response looks like this : {"info1": "1", "data": {"info2": "2", "info3": "3", "info4": "4", "info5": "5", "info6": "6", "info7": "7", "info8": "8", "info9": "9", "info10": "10", "info11": "11", "info12": "12"}}
I want to deserialize this and put the infos from the data {} into a dictionary(string,string). Here's what I tried so far :
Dim js As New System.Web.Script.Serialization.JavaScriptSerializer
Dim test As Dictionary(Of String, String)
test = js.DeserializeObject(TextBox1.Text)
I get no error on build but when i click on the button I get the folowing error : "Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' to type 'System.Collections.Generic.Dictionary`2[System.String,System.String]'."
I don't understand at all what this error mean :s
Thanks for the help
All replies (2)
Monday, July 16, 2012 9:57 AM âś…Answered
Download JSON.NET. Then you will have all you need to deserialize
Monday, July 16, 2012 9:50 AM
Try this:
Cheers!