I am making a program that parses json files for dnd information. I have completed the program, however, I cannot figure out how to define the duplicate keys for the various attacks without manually giving thousands of keys unique ids.
Part of my JSON file:
{
"special_abilities": [
{
"name": "Legendary Resistance (3/Day)",
"desc": "If the tarrasque fails a saving throw, it can choose to succeed instead.",
"attack_bonus": 0
},
{
"name": "Magic Resistance",
"desc": "The tarrasque has advantage on saving throws against spells and other magical effects.",
"attack_bonus": 0
},
{
"name": "Reflective Carapace",
"desc": "Any time the tarrasque is targeted by a magic missile spell, a line spell, or a spell that requires a ranged attack roll, roll a d6. On a 1 to 5, the tarrasque is unaffected. On a 6, the tarrasque is unaffected, and the effect is reflected back at the caster as though it originated from the tarrasque, turning the caster into the target.",
"attack_bonus": 0
},
{
"name": "Siege Monster",
"desc": "The tarrasque deals double damage to objects and structures.",
"attack_bonus": 0
}
]
}
So, how would I define each of the name
keys?
If I can define what I posted up there as searchFile.special_abilities
, how would I define searchFile.special_abilities.name
?