我有来自Web服务的
JSON响应,我需要将其转换为对象然后转换为数组.我的回答类似于下面的回复:
{"status":{"error":"NO","code":"200","description":"none","message":"Request ok"},"geolocation":{"lat":"38.89515","lng":"-77.0310"},"stations":[{"country":"United States","regPrice":"0.00","midPrice":"0.00","prePrice":"0.00","streetAddress":"1401,I St NW","ID":"1900","lat":"38.901440","lng":"-77.032127","stationName":"Shell","logo":"http:\/\/www.nyneaxis.com\/logo\/stations\/nologo.png","state":"District of Columbia","city":"Washington D.C.","regDate":null,"midDate":null,"preDate":null,"distance":"0.7"},{"country":"United States","streetAddress":"2116-2150,M St NW","ID":"13029","lat":"38.905201","lng":"-77.048103","stationName":"Exxon","distance":"1.9"}]}
我现在在控制台中执行此操作是VB.NET.基本上我正在尝试创建一种简单的方法来测试我的API调用并输出信息.我想要完成的是必须遍历JSON数组并列出站点.我以前从未在VB.NET中这样做,并希望得到一些帮助.我一直在阅读有关反序列化的内容但却不理解它.
有一个很好的.NET库,叫做Json.NET,对于做这种东西很有用
http://json.codeplex.com/
原文链接:https://www.f2er.com/vb/255073.html有很多例子,主要是C#.