我有来自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","regPrice":"0.00","midPrice":"0.00","prePrice":"0.00","streetAddress":"2116-2150, M St NW","ID":"13029","lat":"38.905201","lng":"-77.048103","stationName":"Exxon","logo":"http:\/\/www.nyneaxis.com\/logo\/stations\/noLogo.png","state":"District of Columbia","city":"Washington D.C.","regDate":null,"midDate":null,"preDate":null,"distance":"1.9"}]}
Run Code Online (Sandbox Code Playgroud)
我现在在控制台中执行此操作是VB.NET.基本上我正在尝试创建一种简单的方法来测试我的API调用并输出信息.我想要完成的是必须遍历JSON数组并列出站点.我以前从未在VB.NET中这样做,并希望得到一些帮助.我一直在阅读有关反序列化的内容但却不理解它.
你可以使用Json.NET
Dim ThisToken as Token = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Token)(JSonString)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
31244 次 |
最近记录: |