✅ Newtonsoft.Json JsonSerializationException
As the title says, I keep getting a JsonSerializationException. I have no idea how to view the Exception details so if anyone could tell me that'd be nice. I've followed a few tutorials on this topic, but absolutely none have worked. Two exceptions occur in System.Private.CoreLib.dll and one in Newstonesoft.Json.dll
15 Replies
Btw here is the the string that clientJson prints
[{"Client_ID":"SECRET","Client_Secret":"SECRET","Refresh_Token":"%null%","Access_Token":"%null%"}]
well that is not ClientData and you're missing a > in your code
[] represents a list/array
so List<ClientData>
mandatory use System.Text.Json instead of Newtonsoft.Json
Oh the second > is just gone in the message for some reason
Is there a good reason not to use Newtonsoft? I heard it was faster than the default JsonSerializer
no, it's the other way around, by a long shot
Ohhh okay, that's great actually because there's more tutorials on the default lol. Thanks for that information
because nsj was created when there was nothing standardized to do the job or in the BCL now there is, which is STJ which was created by the same people who made nsj.
so yes prefer STJ over NSJ unless you have a very specific use case and fked up json to deal with.
Ahhh okay thank you very much. I'll try using STJ and see how it fares
anyway the json u posted is not just ClientData so u need to either use array or list
Ahhh sorry I'm not well versed in this stuff, how would I go about that?
.Deserialize<ClientData[]>
Ahh okay thank you. Using that it made progress, I just have to adjust some other stuff now
$close
If you have no further questions, please use /close to mark the forum thread as answered
Ohhhh okay, sorry about that
You guys were of much help, thanks to you I managed to get my problem solved! Thanks for helping!