vb.net - JSON deserilaization of single string in JSON -
this json string i'm receive http response.
[{"ts":"1395318389","date":"2014-03-20","time":"12:26:21","nodeid":"1229001363","lat":"53.292425","lon":"-6.43203333333333","speed":"76","dir":"242","sv":"9","volt":"4187","rssi":"-69","us":"3","type":0,"net":"27202","height":"108","hdop":"9","cellid":"eb84","dd":6105,"ttf":"0","lac":"4e24","odo":"0","gle":"0"}]
my class set this
friend class smarttrack_postionlist public positionlist smarttrack_postion() end class friend class smarttrack_postion public ts string public [date] string public time string public nodeid string public lat string public lon string public speed string public dir string public sv string public volt string public rssi string public string public type string public net string public height string public hdop string public cellid string public dd string public ttf string public lac string public odo string public gle string end class
i've tried following lines of code none working
dim ser new system.web.script.serialization.javascriptserializer dim getpositionlist smarttrack_postionlist = directcast(ser.deserialize(of smarttrack_postionlist)(getresult.tostring), smarttrack_postionlist)
and
dim ser new system.web.script.serialization.javascriptserializer dim getpositionlist smarttrack_postion= directcast(ser.deserialize(of smarttrack_postion)(getresult.tostring), smarttrack_postion)
this did work think it's bad coding.
dim ser new system.web.script.serialization.javascriptserializer getresult = getresult.replace("[", "") getresult = getresult.replace("]", "") dim dict dictionary(of string, string) = ser.deserialize(of dictionary(of string, string))(getresult)
i appreciate on this, thanks.
jim
you'll have deserialize json string list(of smarttrack_position)
, like
dim ser = new system.web.script.serialization.javascriptserializer dim json = getresult.tostring() dim getpositionlist = ser.deserialize(of list(of smarttrack_postion))(json)
Comments
Post a Comment