搜索Json字符串

时间:2016-10-11 03:16:31

标签: c++ json

您好我使用Spirit_Json并且我对json没有很好的了解,并且想知道如何从这个文件中获取字符串/整数。

像get函数一样?

{
     "Rune_fire1": {
     "level": 1,
         "name": "Fire Rune 1",
         "damage": 1,
         "hp": 0,
         "runecost": 0,
         "defense": 0,
         "negate": 0,
         "evasion": 0,
         "healing": 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."
     },

1 个答案:

答案 0 :(得分:0)

您可以将库用于json。有一个与boost-lib: enter link description here

还有其他像jsoncpp。