Unity Newtonsoft遍历json中的键值对

为方便平时的编辑和观看,我把StreamingAssets文件夹下的Json改成下面这种类型:

{

"视频1": "火灾的分类",

"视频2": "灭火器的选择",

"视频3": "清水灭火器",

"视频4": "干粉灭火器",

"视频5": "泡沫灭火器",

"视频6": "二氧化碳灭火器",

"视频7": "灭火器维护"

}

那么我想要获取Json中的每一行键值对,该如何遍历呢?

代码片段如下:

cs 复制代码
string path = Path.Combine(Application.streamingAssetsPath, "火灾扑救理论学习视频.json");
        string jsonContent = File.ReadAllText(path);
        JObject jsonObject = JObject.Parse(jsonContent);
        foreach(var 键值对 in jsonObject)
        {
            Debug.Log(键值对.Key + 键值对.Value);
        }
相关推荐
wtsolutions11 小时前
Understanding Excel Data Formats - What Excel to JSON Supports
ui·json·excel
wtsolutions14 小时前
Real-World Use Cases - How Organizations Use Excel to JSON
json·github·excel
cab514 小时前
MyBatis如何处理数据库中的JSON字段
数据库·json·mybatis
FITA阿泽要努力15 小时前
动手体验:5min实现第一个智能体——1
json·api·agent·requests·查询天气·pprint·f-string
wtsolutions15 小时前
Using the Excel to JSON API - Programmatic Access for Developers
ui·json·xhtml
Jet_5816 小时前
神庙逃亡(Temple Run)IL2CPP 逆向实战:从 APK 到 Frida 实现角色无敌
unity·il2cpp·逆向工程·frida·android逆向·hook技术·游戏逆向
石云升16 小时前
Claude Code 配置教程:如何通过修改 settings.json 优化 AI 编程体验
人工智能·json
wtsolutions17 小时前
MCP Service Integration - Excel to JSON for AI and Automation
人工智能·json·excel
cjp56017 小时前
019.C#管道服务,两软件间用json数据交互
开发语言·c#·json