Custom JSON serializer not working
Hello
I have a custom serializer i cannot get to work.
When I use the model in a controller, it just gives me null.
It is the following class I try to serialize
I want to be able to use the following input
This is my serializer.
Is should just take the string, and wrap it in a ExternalId
I have tried to put break points in here also, but they are never reached
And last, this is where I add my serializer
4 Replies
Not sure I understand the intent, and idk the problem. But just in case you aren't aware and it might help you, you can natively serialize to a Dictionary<string,string> or <string,object>, if you have some arbitrary keys that you don't know ahead of time
Newtonsoft also has an attribute to put all keys not defined on the model into such a dictionary
that JSON Converter looks a lot like a
System.Text.JSON
one, do they share the same base class?Ohh, didn't realise they were called the same...
I can see its using System.text 😦
So, I hav removed Newtonsoft from my project, and is now using Sytem.Text everywhere.
However, I still see the same problem.
I have updated my code examples to show what I do.
is how I've done it
I don't know how you'd do it with your services registration though