I'm trying to use JavaScriptSerializer to parse some json string to create objects. I'm thinking about implementing something like this but no luck on my end...
Dim object As New SomeObject
Dim js As New JavaScriptSerializer
someObject = js.Deserialize(Of Somebject)(jsonstr)
object1.var1 = someObject("somekey")
where jsonstr is data in json format. I can't use any third party library like newtonsoft.json etc.
edit: I made some progress, given my class e.g. has property "name" and my json has key "name" as well it will pass on the string to objects property with whatever value the json file has.
Dim object As SomeObject = js.Deserialize(Of SomeObject)(jsonstr)
Dim name As String = object.name //object now holds value for name
but if my json is like this. How can I get name in the following?
"value" : {
"validationFactors" : [
{
"name" : "remote_address",
"value" : "127.0.0.1"
}
]
}
If I call Deserialize to get name for e.g I get MissingMethodException Do I need to change my dummy object and if so how? Thanks
no luck on my endmean? is there an error message? Does all or part of it not deserialize?no luckis a feeble problem descriptionI can't use any third party library?