【发布时间】:2019-04-26 02:31:12
【问题描述】:
我正在调用一个 API,它给了我一个像
这样的 json 响应{
"symbol": "AAPL",
"stock_exchange_short": "NASDAQ",
"timezone_name": "America/New_York",
"intraday": {
"2018-11-21 15:59:00": {
"open": "177.24",
"close": "176.77",
"high": "177.25",
"low": "176.77",
"volume": "430073"
},
"2018-11-21 15:58:00": {
"open": "177.23",
"close": "177.23",
"high": "177.25",
"low": "177.12",
"volume": "188425"
},
"2018-11-21 15:57:00": {
"open": "177.18",
"close": "177.21",
"high": "177.24",
"low": "177.11",
"volume": "163151"
},
现在我想访问所有数据,所以我需要创建一个对象,但是当我使用 Json2cSharp 转换器时,它会给我一个无效类型的对象名称。 那么我应该制作哪种类型的对象,以便我可以定期访问所有数据。 请帮忙。
【问题讨论】:
-
使用VisualStudio的“编辑->选择性粘贴->将JSON粘贴为类”,它会为你生成必要的类。
-
@SeM,我在 VS2013 中找不到将 JSON 粘贴为类。你能帮帮我吗?
标签: c# asp.net json asp.net-mvc api