❔ problem loading json into dynamic object
I have a problem loading a json file into a dynamic object in c#. My problem is that some parameters of the c# file have a "-" in the keyword, such as the "official-artwork" parameter. Under what name can I access it now?
My Code:
8 Replies
You shouldn't be using dynamic
And it's recommended not to use NewtonSoft
There are Json to c# generators online, and visual studio allows you to paste Json as c# classes as well
To answer your actual question, afaik both Newtonsoft and System.Text.Json (the newer generally better library) allows you to specify the JSON names for each property in a class.
Which is also why you shouldn't be using
dynamic
whats wrong with newtonsoft?
And how exactly can i paste json as c# classes in vs?
Newtonsoft is just kinda... outdated? System.Text.Json is built-in, faster, and can do everything that Newtonsoft can.
Afaik it's a button under "edit" which says "paste special"
Not actually everything, but most of it.
Yeah
although I think it covers most the features most people need
okay thank you all
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.