I am trying to make a list of all items in the game using System.Text.Json;
I am very new to using .json files
I have tried doing this to test if it works:
List<Item> AllItems = new List<Item>();
string json = File.ReadAllText("Items.json");
AllItems = Deserialize<List<Item>>(json);
WriteLine(AllItems[0].Name);
It doesnt let me Convert It into a list This is the json file
{
"Item": [
{
"Weapon": [
{
"CritChance": 60,
"HitChance": 80,
"OGDamge": 15,
"Damage": 15,
"Damage_Type": "Physical",
"Weapon_Type": "Fist",
"Player": null,
"APUsage": 4,
"ID": 1,
"Name": "Debug",
"Value": 16,
"Rarity": "Common",
"Item_Type": "Weapon"
},
{
"CritChance": 40,
"HitChance": 70,
"OGDamge": 15,
"Damage": 15,
"Damage_Type": "Electric",
"Weapon_Type": "Bow",
"Player": null,
"APUsage": 5,
"ID": 2,
"Name": "Debug2",
"Value": 15,
"Rarity": "Common",
"Item_Type": "Weapon"
}
]
}
]
}
Can anyone help me out :)

ItemandWeaponclass. You will also have to decide what type ofPlayeris going to be considering it'snull.List<>. It contains a JSON object with a property calledItem, which then contains a list.