I have a class library that I need to output through JsonResult in an ASP.NET MVC environment. (JsonResult uses JsonSerializer to create its output.)
I found, after reading the documentation, that if you put [ScriptIgnore] in a public property / field, it will not be serialized, like [XmlIgnore] for an XML serializer.
I need the equivalent functionality [XmlElement("elementname")] , which fully defines the name of the field / property in the output serialization. I have a field called Elements that needs to be serialized into a field called Elements .
How to do this using default JsonSerializer?
Thanks David
source share