'Download values of list from json file with 2 objects
I want to create simple game and i need to get values from json or change them. I have 3 classes.
public class Person
{
public string Specjality { get; set; }
public int PWZ { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public List<string> Items { get; set; }
}
public class Monster
{
public string Name { get; set; }
public List<string> Skills { get; set; }
}
public class Root
{
public List<Person> people { get; set; }
public List<Monster> monsters { get; set; }
}
Json file
{
"Person": [
{
"Speciality": "Archer",
"PWZ": 432742,
"Name": "Charlie",
"Surname": "Evans",
"Items": [
"Bow",
"Arrow",
]
},
{
"Speciality": "Soldier",
"PWZ": 432534879,
"Name": "Harry",
"Surname": "Thomas",
"Items": [
"Gun",
"Knife",
]
}
],
"Monster": [
{
"Name": "Papua",
"Skills": [
"Jump",
"SlowWalk",
]
},
{
"Name": "Geot",
"Skills": [
"Run",
"Push",
]
}
]
}
My first problem is how to deserialize it, next how to print chosen values (for examples Skills of first Monster) on the screen and how to change some values (for example change "Jump" from Monster Skills to "Teleport" or change Name of Person). Thanks for all answers.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
