json - 从 URL 反序列化 JSON - 如何将其添加到多个对象
问题描述
所以基本上我通过jsonUtils运行 JSON,它创建了一个对象,结果证明是几个对象。
所以请教2个问题:
- 如何最好地从 URL 填充对象?
- 我可以选择要填充的对象,即我不想做所有 20 个对象吗?
先谢谢了!!
WebClient client = new WebClient();
string myJSON = client.DownloadString("https://someURL.geojson");
var myClass = Newtonsoft.Json.JsonConvert.DeserializeObject(myJSON);
Console.Write(myClass.ToString());
public class PrecipType
{
public string units { get; set; }
public string value { get; set; }
}
public class Press
{
public string units { get; set; }
public string value { get; set; }
}
public class Atmo
{
public AirTemperature air_temp{ get; set; }
public Dewpoint dew_point{ get; set; }
public Wind { get; set; }
public Pressure pressure { get; set; }
}
public class ObsTime
{
public string units { get; set; }
public string value { get; set; }
}
解决方案
推荐阅读
- reactjs - 尝试使用 Semantic UI React Dropdown 时出现“TypeError: Object(...) is not a function”错误
- postgresql - 如何将递归转换为plpgsql中的函数?
- c# - C# SQL 选择在哪里
LIKE %Column% - 格式? - javascript - 在 Safari IOS12 上禁用双击缩放/调整大小***
- javascript - ChartJS 散点图将最高点和最低点减半
- c++ - 如何将表达式转换/评估为变量
- android - Ionic Android Build - com.google.android.gms:play-services-measurement-base 错误
- python-3.x - 如何使用 Python 将“文本文档”与“球形 k 均值”聚类?
- reactjs - 数组更改时反应选择选项列表不会更改
- javascript - 如何处理 node.js 承诺链中的错误并解析承诺数组