C
C#10mo ago
TheGoose

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

No description
4 Replies
mtreit
mtreit10mo 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
Pobiega10mo 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
Buddy10mo ago
{ } object [ ] array
Pobiega
Pobiega10mo ago
public record RootObject(List<Spell> Spell);
public record RootObject(List<Spell> Spell);
should work, if you pass serialization options to change the casing
Want results from more Discord servers?
Add your server