🍠JSON Example for a game
How would a JSON data for a computer game look like? You can see the data live at https://6away.org/data.json or below
{
"player": {
"name": "Jane Doe",
"class": "Warrior",
"level": 15,
"hp": 150,
"strength": 20,
"dexterity": 15,
"intelligence": 10,
"inventory": ["sword", "shield", "healing potion"],
"questLog": [
{ "name": "Rescue the Princess", "status": "in progress" },
{ "name": "Defeat the Dragon", "status": "not started" }
]
},
"npcs": [
{
"name": "Bob",
"location": "town square",
"dialogue": "Hello adventurer! Are you here to help with the goblin problem?"
},
{
"name": "Alice",
"location": "inn",
"dialogue": "Welcome to the inn. Would you like a room for the night?"
}
],
"enemies": [
{ "name": "Goblin", "hp": 10, "attack": 3, "defense": 1 },
{ "name": "Skeleton", "hp": 20, "attack": 5, "defense": 2 }
],
"items": [
{ "name": "healing potion", "description": "Restores 50 HP.", "value": 50 },
{
"name": "strength potion",
"description": "Temporarily increases strength by 5.",
"value": 75
}
],
"quests": [
{
"name": "Rescue the Princess",
"description": "The princess has been kidnapped by the evil sorcerer. Rescue her and bring her back to the castle.",
"reward": "100 gold pieces"
},
{
"name": "Defeat the Dragon",
"description": "A dragon has been terrorizing the countryside. Defeat it and bring back its hoard as proof.",
"reward": "500 gold pieces"
}
],
"locations": [
{
"name": "town square",
"description": "The bustling town square is filled with vendors and townspeople going about their business."
},
{
"name": "inn",
"description": "The inn is a cozy place to rest and recover. The proprietor, Alice, is friendly and welcoming."
},
{
"name": "dragon's lair",
"description": "The entrance to the dragon's lair is guarded by a group of goblins. The lair itself is dark and filled with treasure."
}
],
"cutscenes": [
{
"name": "Intro",
"script": "The kingdom of Araland is in peril. An evil sorcerer has seized control of the throne and taken the princess captive. As the bravest and most skilled warrior in the land, it falls to you to rescue her and restore peace to the kingdom."
},
{
"name": "Defeat the Dragon",
"script": "As you approach the dragon's lair, you can hear its fierce roar. You draw your sword and prepare to do battle. The fight is long and hard, but in the end, you emerge victorious. You take the dragon's hoard as proof of your victory and set off back to the kingdom."
}
],
"options": {
"difficulty": "normal",
"language": "english"
}
}
In the next chapter we will see how we can fetch this data
Last updated