Open links in new tab
  1. How to serialize properties of derived classes with System.Text.Json ...

    Serialize properties of derived classes Beginning with .NET 7, System.Text.Json supports polymorphic type hierarchy serialization and deserialization with attribute annotations.

  2. How to serialize JSON in C# - .NET | Microsoft Learn

    Use AI to serialize to JSON You can use AI tools, such as GitHub Copilot, to generate code that uses System.Text.Json to serialize to JSON. You can customize the prompt to fit your object fields and …

  3. How to use source generation in System.Text.Json - .NET

    By default, both source generation modes (metadata-based and serialization optimization) are used if you don't specify one. For information about how to specify the mode to use, see Specify source …

  4. SerializableAttribute Class (System) | Microsoft Learn

    Indicates that a class can be serialized using binary or XML serialization. This class cannot be inherited.

  5. XmlSerializer Class (System.Xml.Serialization) | Microsoft Learn

    using System; using System.Xml; using System.Xml.Serialization; using System.IO; /* The XmlRootAttribute allows you to set an alternate name (PurchaseOrder) of the XML element, the …

  6. Source-generation modes in System.Text.Json - .NET

    Feb 25, 2025 · Source generation can be used in two modes: metadata-based and serialization optimization. This article describes the different modes. For information about how to use source …

  7. XML Serializer Generator tool (Sgen.exe) - .NET | Microsoft Learn

    Apr 25, 2024 · The XML Serializer Generator creates an XML serialization assembly for types in a specified assembly. The serialization assembly improves the startup performance of a XmlSerializer …

  8. Migrate from Newtonsoft.Json to System.Text.Json - .NET

    Starting in .NET 7, System.Text.Json supports polymorphic serialization through the JsonDerivedTypeAttribute attribute. For more information, see Serialize properties of derived classes.

  9. Custom serialization and deserialization contracts - .NET

    Jun 16, 2023 · The following list shows just some examples of the types of customizations you can make to serialization and deserialization: Serialize private fields and properties.

  10. How to customize property names and values with System.Text.Json

    Update #ClassName: when the property name contains more than one word, change the serialized property name to use underscores between words. Use built-in serialization attributes. Here's a more …