C
C#5mo ago
TheGoose

can someone help me with this? i dont know how to make it an array

No description
4 Replies
mtreit
mtreit5mo ago
You should ideally deserialize your JSON into a type that matches the structure of the JSON. List<Spell> is apparently not what your JSON represents. Looks like it's a single Spell. Does deserializing into Spell instead of List<Spell> work?
Pobiega
Pobiega4mo ago
the json structure seems to begin with...
{
"spell": [
{
"name": "Acid Splash",
...
}]
}
{
"spell": [
{
"name": "Acid Splash",
...
}]
}
so the outmost token is an object, not a list
Buddy
Buddy4mo ago
{ } object [ ] array
Pobiega
Pobiega4mo ago
public record RootObject(List<Spell> Spell);
public record RootObject(List<Spell> Spell);
should work, if you pass serialization options to change the casing