c# - 使用 C# 和 Unity 处理强大的清单项目,想知道这是否是从这个 json 文件中检索嵌套值的正确方法
问题描述
我正在尝试art
从 json 文件中获取值,这包括 values sid, artId, token, name, description, width, height
。数据看起来或多或少是这样的:
{
"searchId": null,
"listings": [{
"sid": 0,
"id": 25,
"status": 3,
"art": {
"sid": 0,
"artId": 24,
"token": "a5",
"name": "Aq",
"description": "Paint",
"width": 18.0000,
"height": 24.0000,
"artist": {
"token": null,
"firstName": "V",
"lastName": "G",
"visibleInSearch": false,
"inventoryVisibleInSearch": false
}
]
}
我正在构建一个像这样的数据库列表:new Art((int)itemData[0]["listings"]["art"][i]
["sid"]
,new Art((int)itemData[0]["listings"]["art"][i]
["artId"]
等等。
这是获取值的正确方法art
吗?
使用这种方法我得到了错误InvalidOperationException: Instance of JsonData is not a dictionary
我刚刚切换了 json 格式,因此获得更多“嵌套”数据对我来说是新的。
谢谢!
解决方案
推荐阅读
- sql - 如何在 VB.net 中创建 SQL 数据库?
- excel - VBA Excel递归文件夹搜索停止
- types - 下面的 OCaml 行是做什么的: type reply = (string * string list * string, error_t) result;;?
- android - 如何导出我的手机在过去 8 小时内的活动?
- node.js - 电子打包机 win32 不打开窗口
- node.js - Mocha - 循环遍历在 before() 中初始化的数组失败
- amazon-iam - AWS IAM:这是基于资源或身份的策略吗?
- c# - Hangfire.AspNetCore.dll 中出现“System.StackOverflowException”类型的未处理异常
- react-router - React-router 链接在共享时被转义
- android - 在 onClickListener 中关闭 Anko 对话框