JsonSerialization Help
I have this class in C# (functionallity removed)
A record that allows parsing of multiple commands:
and this is the json file:
I get this error:
Serialization has the
IncludeFields
option set to true and all properties has JsonIgnore
on them. Can someone please help?19 Replies
flags
isnt a list its a Dict<string, string>
but thats a weird api
why even make that a dictionary
i think in this case youd need an ordered list of key value pairs
and manually map ityoure correct
i've changed it to a list of dict<string, string>
still not working though
right but now the issue is when you have multiple flags
youre going to have more than one "name" key and more than one "value" key
i assume
see what i mean?
oh
so flags should be:
wait so is this the correct json?
because this is now an array of objects
still incorrect
im lost
is this your api?
what do you want to do exactly?
flag is a simple record
maybe I should've done this one different?
it says the problem is in the
Command
classin this case it would serialize to
but what are you trying to do?
if you don't want the serializer to use the constructor there's probably an attribute for that
There is but it doesn't matter ig
wdym?
that's why you're getting the exception
I created this
is has everything even names are the same between json and variables
like it should
still error
and whats the entire json youre deserializing?
commands is a list of commands
lol i forgot how json worked
this is wrong
this is what your model looks like in json:
sibber
REPL Result: Success
Result: string
Compile: 473.919ms | Execution: 80.263ms | React with ❌ to remove this embed.
typing code on my phone is a pita
How can I make it without underscore
thats just because i copy pasted the properties because im lazy
you can name them whatever you want and make it case insensitive