如何在json文件中查找str / int?

时间:2016-10-10 17:47:20

标签: c++ json

我有一个json充满了几个条目(游戏项目的魔法符文)。我也使用spirit_json,我需要一种方法,在c ++中我可以从这个json中获取一个字符串。如果这很容易,那么我也想知道如何查看我正在搜索此字符串的任何魔法符号的名称。

为了不混淆说json中有5个符文,符文1,符文2等等。我将如何在c ++中从其中一个符文中拉出一个字符串?

我对json的知识非常薄弱,我试过阅读关于这个和json_spirit的git hub的几个主题,但我仍然在努力解决它。如果没有人可以帮助解决上述问题,你至少可以指出我正确的方向吗?

提前感谢您的帮助!

{      " Rune_fire1":{      "等级":1,          " name":" Fire Rune 1",          "伤害":1,          " hp":0,          " runecost":0,          "防守":0,          "否定":0,          " evasion":0,          "愈合":0,

     "description": "The First Shard of the Fire Rune."
 },


 "Rune_fire2": {
 "level": 1,
     "name": "Fire Rune 2",
     "damage": 2,
     "hp": 0,
     "runecost": 0,
     "defense": 0,
     "negate": 0,
     "evasion": 0,
     "healing": 0,
     "description": "The Second Shard of the Fire Rune."
 },


 "Rune_fire3": {
 "level": 1,
     "name": "Fire Rune 3",
     "damage": 3,
     "hp": 0,
     "runecost": 0,
     "defense": 0,
     "negate": 0,
     "evasion": 0,
     "healing": 0,
     "description": "The Third Shard of the Fire Rune."
 },


 "Rune_fire4": {
 "level": 1,
     "name": "Fire Rune 4",
     "damage": 4,
     "hp": 0,
     "runecost": 0,
     "defense": 0,
     "negate": 0,
     "evasion": 0,
     "healing": 0,
     "description": "The Fourth Shard of the Fire Rune."
 },


 "Rune_fire5": {
 "level": 1,
     "name": "Fire Rune 5",
     "damage": 5,
     "hp": 0,
     "runecost": 0,
     "defense": 0,
     "negate": 0,
     "evasion": 0,
     "healing": 0,
     "description": "The Fifth Shard of the Fire Rune."
 },

0 个答案:

没有答案