【发布时间】:2018-09-04 07:10:44
【问题描述】:
我在 Visual Studio 中有一个 C# 项目,我正在使用 JSON.net,我有一个包含 5 个对象的 JSON 文件。我希望当我单击一个按钮时,来自 5 个对象的“名称”和“描述”等特定数据会出现在一个文本框中。
我不知道要使用什么方法,所以我可以访问 JSON 文件并获取其中的数据。
我在网上读到 JSON 只是一种格式化数据的方式,如果我要做查询之类的事情,我应该使用数据库。
这是 JSON 文件:
{
"Fighter Features":{
"Fighting Style (Archery)":{
"name":"Fighting Style (Archery)",
"Description:":"You gain +2 bonus to attack rolls you make with ranged weapons."
},
"Second Wind":{
"name":"Second Wind",
"Description:":"Vou have a limited well of stamina that you can draw on to protect Yourself from harm. On your turn, you can use a bonus action to regain hit points equal to ld10 + your fighter leveI."
},
"Fighthing Style (Defense)":{
"name":"Fighting Style (Defense)",
"Description:":"While you are wearing armor you gain a +1 bonus to AC."
}
}
}
【问题讨论】:
-
我删除了你的
visual-studio标签,因为这不是关于 Visual Studio IDE 的问题,所以标签被滥用了。我还根据tagging 从您的问题标题中删除了标签