gpt4 book ai didi

vb.net - 将 JSON 字符串转换为 JSON 对象

转载 作者:行者123 更新时间:2023-12-04 14:04:36 25 4
gpt4 key购买 nike

我有一个来自 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"}]}

我现在在控制台中这样做是 VB.NET。基本上,我正在尝试创建一种简单的方法来测试我的 API 调用并输出信息。我想要完成的是必须遍历 JSON 数组并列出电台。我以前从未在 VB.NET 中这样做过,希望得到一些帮助。我一直在阅读有关反序列化的内容,但不明白。

最佳答案

您可以使用 Json.NET

Dim ThisToken as Token = Newtonsoft.Json.JsonConvert.DeserializeObject(Of Token)(JSonString)

关于vb.net - 将 JSON 字符串转换为 JSON 对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8904522/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com