{"id":54023,"date":"2024-10-15T08:15:00","date_gmt":"2024-10-15T15:15:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/dotnet\/?p=54023"},"modified":"2024-10-15T20:19:36","modified_gmt":"2024-10-16T03:19:36","slug":"system-text-json-in-dotnet-9","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/system-text-json-in-dotnet-9\/","title":{"rendered":"What&#8217;s new in System.Text.Json in .NET 9"},"content":{"rendered":"<p>The 9.0 release of System.Text.Json includes many features, primarily with a focus on JSON schema and intelligent application support. It also includes highly requested enhancements such as nullable reference type support, customizing enum member names, out-of-order metadata deserialization and customizing serialization indentation.<\/p>\n<h3>Getting the latest bits<\/h3>\n<p>You can try out the new features by referencing the latest build of <a href=\"https:\/\/www.nuget.org\/packages\/System.Text.Json\">System.Text.Json NuGet package<\/a> or the <a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/9.0\">latest SDK for .NET 9<\/a>.<\/p>\n<h2>JSON Schema Exporter<\/h2>\n<p>The new <code>JsonSchemaExporter<\/code> class can be used to extract <a href=\"https:\/\/json-schema.org\/\">JSON schema<\/a> documents from .NET types using either <code>JsonSerializerOptions<\/code> or <code>JsonTypeInfo<\/code> instances:<\/p>\n<pre><code class=\"language-csharp\">using System.Text.Json.Schema;\n\nJsonSerializerOptions options = JsonSerializerOptions.Default;\nJsonNode schema = options.GetJsonSchemaAsNode(typeof(Person));\nConsole.WriteLine(schema.ToString());\n\/\/{\n\/\/  \"type\": [\"object\", \"null\"],\n\/\/  \"properties\": {\n\/\/    \"Name\": { \"type\": \"string\" },\n\/\/    \"Age\": { \"type\": \"integer\" },\n\/\/    \"Address\": { \"type\": [\"string\", \"null\"], \"default\": null }\n\/\/  },\n\/\/  \"required\": [\"Name\", \"Age\"]\n\/\/}\n\nrecord Person(string Name, int Age, string? Address = null);<\/code><\/pre>\n<p>The resultant schema provides a specification of the JSON serialization contract for the type. As can be seen in this example, it distinguishes between nullable and non-nullable properties and populates the <code>required<\/code> keyword by virtue of a constructor parameter being optional or not. The schema output can be influenced by configuration specified in the <code>JsonSerializerOptions<\/code> or <code>JsonTypeInfo<\/code> instances:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = new(JsonSerializerOptions.Default)\n{\n    PropertyNamingPolicy = JsonNamingPolicy.KebabCaseUpper,\n    NumberHandling = JsonNumberHandling.WriteAsString,\n    UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow,\n};\n\nJsonNode schema = options.GetJsonSchemaAsNode(typeof(MyPoco));\nConsole.WriteLine(schema.ToString());\n\/\/{\n\/\/  \"type\": [\"object\", \"null\"],\n\/\/  \"properties\": {\n\/\/    \"NUMERIC-VALUE\": {\n\/\/      \"type\": [\"string\", \"integer\"],\n\/\/      \"pattern\": \"^-?(?:0|[1-9]\\\\d*)$\"\n\/\/    }\n\/\/  },\n\/\/  \"additionalProperties\": false\n\/\/}\n\nclass MyPoco\n{\n    public int NumericValue { get; init; }\n}<\/code><\/pre>\n<p>The generated schema can be further controlled using the <code>JsonSchemaExporterOptions<\/code> configuration type:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = JsonSerializerOptions.Default;\nJsonSchemaExporterOptions exporterOptions = new()\n{\n    \/\/ Marks root-level types as non-nullable\n    TreatNullObliviousAsNonNullable = true,\n};\n\nJsonNode schema = options.GetJsonSchemaAsNode(typeof(Person), exporterOptions);\nConsole.WriteLine(schema.ToString());\n\/\/{\n\/\/  \"type\": \"object\",\n\/\/  \"properties\": {\n\/\/    \"Name\": { \"type\": \"string\" }\n\/\/  },\n\/\/  \"required\": [\"Name\"]\n\/\/}\n\nrecord Person(string Name);<\/code><\/pre>\n<p>Finally, users are able to apply their own transformations to generated schema nodes by specifying a <code>TransformSchemaNode<\/code> delegate. Here&#8217;s an example that incorporates text from <code>DescriptionAttribute<\/code> annotations:<\/p>\n<pre><code class=\"language-csharp\">JsonSchemaExporterOptions exporterOptions = new()\n{\n    TransformSchemaNode = (context, schema) =&gt;\n    {\n        \/\/ Determine if a type or property and extract the relevant attribute provider\n        ICustomAttributeProvider? attributeProvider = context.PropertyInfo is not null\n            ? context.PropertyInfo.AttributeProvider\n            : context.TypeInfo.Type;\n\n        \/\/ Look up any description attributes\n        DescriptionAttribute? descriptionAttr = attributeProvider?\n            .GetCustomAttributes(inherit: true)\n            .Select(attr =&gt; attr as DescriptionAttribute)\n            .FirstOrDefault(attr =&gt; attr is not null);\n\n        \/\/ Apply description attribute to the generated schema\n        if (descriptionAttr != null)\n        {\n            if (schema is not JsonObject jObj)\n            {\n                \/\/ Handle the case where the schema is a boolean\n                JsonValueKind valueKind = schema.GetValueKind();\n                Debug.Assert(valueKind is JsonValueKind.True or JsonValueKind.False);\n                schema = jObj = new JsonObject();\n                if (valueKind is JsonValueKind.False)\n                {\n                    jObj.Add(\"not\", true);\n                }\n            }\n\n            jObj.Insert(0, \"description\", descriptionAttr.Description);\n        }\n\n        return schema;\n    }\n};<\/code><\/pre>\n<p>Tying it all together, we can now generate a schema that incorporates <code>description<\/code> keyword source from attribute annotations:<\/p>\n<pre><code class=\"language-csharp\">JsonNode schema = options.GetJsonSchemaAsNode(typeof(Person), exporterOptions);\nConsole.WriteLine(schema.ToString());\n\/\/{\n\/\/  \"description\": \"A person\",\n\/\/  \"type\": [\"object\", \"null\"],\n\/\/  \"properties\": {\n\/\/    \"Name\": { \"description\": \"The name of the person\", \"type\": \"string\" }\n\/\/  },\n\/\/  \"required\": [\"Name\"]\n\/\/}\n\n[Description(\"A person\")]\nrecord Person([property: Description(\"The name of the person\")] string Name);<\/code><\/pre>\n<p>This is a particularly useful component when it comes to generating schemas for .NET methods or APIs; it is being used to power ASP.NET Core&#8217;s newly released OpenAPI component and we&#8217;ve deployed it to a number of AI related libraries and applications with tool calling requirements such as Semantic Kernel, Visual Studio Copilot and the newly released Microsoft.Extensions.AI library.<\/p>\n<h2>Streaming multiple JSON documents<\/h2>\n<p><code>Utf8JsonReader<\/code> now supports reading multiple, whitespace-separated JSON documents from a single buffer or stream. By default, <code>Utf8JsonReader<\/code> will throw an exception if it detects any non-whitespace characters that are trailing the first top-level document. This behavior can be changed using the <code>JsonReaderOptions.AllowMultipleValues<\/code> flag:<\/p>\n<pre><code class=\"language-csharp\">JsonReaderOptions options = new() { AllowMultipleValues = true };\nUtf8JsonReader reader = new(\"null {} 1 \\r\\n [1,2,3]\"u8, options);\n\nreader.Read();\nConsole.WriteLine(reader.TokenType); \/\/ Null\n\nreader.Read();\nConsole.WriteLine(reader.TokenType); \/\/ StartObject\nreader.Skip();\n\nreader.Read();\nConsole.WriteLine(reader.TokenType); \/\/ Number\n\nreader.Read();\nConsole.WriteLine(reader.TokenType); \/\/ StartArray\nreader.Skip();\n\nConsole.WriteLine(reader.Read()); \/\/ False<\/code><\/pre>\n<p>This additionally makes it possible to read JSON from payloads that may contain trailing data that is invalid JSON:<\/p>\n<pre><code class=\"language-csharp\">Utf8JsonReader reader = new(\"[1,2,3]    &lt;NotJson\/&gt;\"u8, new() { AllowMultipleValues = true });\n\nreader.Read();\nreader.Skip(); \/\/ Success\nreader.Read(); \/\/ throws JsonReaderException<\/code><\/pre>\n<p>When it comes to streaming deserialization, we have included a new <code>JsonSerializer.DeserializeAsyncEnumerable<\/code> overload that makes streaming multiple top-level values possible. By default, <code>DeserializeAsyncEnumerable<\/code> will attempt to stream elements that are contained in a top-level JSON array. This behavior can be toggled using the new <code>topLevelValues<\/code> flag:<\/p>\n<pre><code class=\"language-csharp\">ReadOnlySpan&lt;byte&gt; utf8Json = \"\"\"[0] [0,1] [0,1,1] [0,1,1,2] [0,1,1,2,3]\"\"\"u8;\nusing var stream = new MemoryStream(utf8Json.ToArray());\n\nawait foreach (int[] item in JsonSerializer.DeserializeAsyncEnumerable&lt;int[]&gt;(stream, topLevelValues: true))\n{\n    Console.WriteLine(item.Length);\n}<\/code><\/pre>\n<h2>Respecting nullable annotations<\/h2>\n<p><code>JsonSerializer<\/code> now adds limited support for non-nullable reference type enforcement in serialization and deserialization. This can be toggled using the <code>RespectNullableAnnotations<\/code> flag:<\/p>\n<pre><code class=\"language-csharp\">#nullable enable\nJsonSerializerOptions options = new() { RespectNullableAnnotations = true };\n\nMyPoco invalidValue = new(Name: null!);\nJsonSerializer.Serialize(invalidValue, options);\n\/\/ System.Text.Json.JsonException: The property or field 'Name'\n\/\/ on type 'MyPoco' doesn't allow getting null values. Consider\n\/\/ updating its nullability annotation. \n\nrecord MyPoco(string Name);<\/code><\/pre>\n<p>Similarly, this setting adds enforcement on deserialization:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = new() { RespectNullableAnnotations = true };\nstring json = \"\"\"{\"Name\":null}\"\"\";\nJsonSerializer.Deserialize&lt;MyPoco&gt;(json, options);\n\/\/ System.Text.Json.JsonException: The constructor parameter 'Name'\n\/\/ on type 'MyPoco' doesn't allow null values. Consider updating\n\/\/ its nullability annotation.<\/code><\/pre>\n<h3>Limitations<\/h3>\n<p>Due to how non-nullable reference types are implemented, this feature comes with an important number of limitations that users need to familiarize themselves with before turning it on. The root of the issue is that reference type nullability has no first-class representation in IL, as such the expressions <code>MyPoco<\/code> and <code>MyPoco?<\/code> <a href=\"https:\/\/sharplab.io\/#v2:D4AQTAjAsAULAqBPADgUwAQBcLoLzvlQGdMAeAWUQAUB7AYxoD4AKASgG4EUNMw8DiZSrQYB+Fh1iwQEAJzNsefL0kwZANgLcBJUvAl5GWbjQBmzeKul9h9GuyA=\">are indistinguishable from the perspective of run-time reflection<\/a>. While the compiler will try to make up for that by <a href=\"https:\/\/sharplab.io\/#v2:D4AQTAjAsAULBOBTAxge3gEwAQFkCeACqmgBQgQAMWAcqgC7UCuANswMp3wCWAdgOYAaLOQoB+Gi2YBDAEbNEHbvwCUAbiA=\">emitting attribute metadata where possible<\/a>, this is restricted to non-generic member annotations that are scoped to a particular type definition. It is for this reason that the flag only validates nullability annotations that are present on non-generic properties, fields, and constructor parameters. System.Text.Json does not support nullability enforcement on<\/p>\n<ul>\n<li>Top-level types, aka the type that is passed when making the first <code>JsonSerializer.(De)serialize<\/code> call.<\/li>\n<li>Collection element types, aka we cannot distinguish between <code>List&lt;string&gt;<\/code> and <code>List&lt;string?&gt;<\/code> types.<\/li>\n<li>Any properties, fields, or constructor parameters that are generic.<\/li>\n<\/ul>\n<p>If you are looking to add nullability enforcement in these cases, we recommend that you either model your type to be a struct (since they do not admit <code>null<\/code> values) or author a custom converter that overrides its <a href=\"https:\/\/learn.microsoft.com\/dotnet\/api\/system.text.json.serialization.jsonconverter-1.handlenull\"><code>HandleNull<\/code><\/a> property to <code>true<\/code>.<\/p>\n<h3>Feature switch<\/h3>\n<p>Users can turn on the <code>RespectNullableAnnotations<\/code> setting globally using the <code>System.Text.Json.Serialization.RespectNullableAnnotationsDefault<\/code> feature switch, which can be set via your project configuration:<\/p>\n<pre><code class=\"language-xml\">&lt;ItemGroup&gt;\n  &lt;RuntimeHostConfigurationOption Include=\"System.Text.Json.Serialization.RespectNullableAnnotationsDefault\" Value=\"true\" \/&gt;\n&lt;\/ItemGroup&gt;<\/code><\/pre>\n<h3>On the relation between nullable and optional parameters<\/h3>\n<p>It should be noted that <code>RespectNullableAnnotations<\/code> does not extend enforcement to unspecified JSON values:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = new() { RespectNullableAnnotations = true };\nvar result = JsonSerializer.Deserialize&lt;MyPoco&gt;(\"{}\", options); \/\/ No exception!\nConsole.WriteLine(result.Name is null); \/\/ True\n\nclass MyPoco\n{\n    public string Name { get; set; }\n}<\/code><\/pre>\n<p>This is because STJ treats required and non-nullable properties as orthogonal concepts. This stems from the C# language itself where you can have <code>required<\/code> properties that are nullable:<\/p>\n<pre><code class=\"language-csharp\">MyPoco poco = new() { Value = null }; \/\/ No compiler warnings\n\nclass MyPoco\n{\n    public required string? Value { get; set; }\n}<\/code><\/pre>\n<p>And optional properties that are non-nullable:<\/p>\n<pre><code class=\"language-csharp\">class MyPoco\n{\n    public string Value { get; set; } = \"default\";\n}<\/code><\/pre>\n<p>The same orthogonality applies to constructor parameters:<\/p>\n<pre><code class=\"language-csharp\">record MyPoco(\n    string RequiredNonNullable,\n    string? RequiredNullable,\n    string OptionalNonNullable = \"default\",\n    string? OptionalNullable = \"default\");<\/code><\/pre>\n<h2>Respecting non-optional constructor parameters<\/h2>\n<p>STJ constructor-based deserialization has historically been treating all constructor parameters as optional, as can be highlighted in the following example:<\/p>\n<pre><code class=\"language-csharp\">var result = JsonSerializer.Deserialize&lt;Person&gt;(\"{}\");\nConsole.WriteLine(result); \/\/ Person { Name = , Age = 0 }\n\nrecord Person(string Name, int Age);<\/code><\/pre>\n<p>In .NET 9 we&#8217;re including the <code>RespectRequiredConstructorParameters<\/code> flag that changes the behavior such that non-optional constructor parameters are now treated as required:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = new() { RespectRequiredConstructorParameters = true };\nstring json = \"\"\"{\"Optional\": \"value\"}\"\"\";\nJsonSerializer.Deserialize&lt;MyPoco&gt;(json, options);\n\nrecord MyPoco(string Required, string? Optional = null);\n\/\/ JsonException: JSON deserialization for type 'MyPoco' \n\/\/ was missing required properties including: 'Required'.<\/code><\/pre>\n<h3>Feature switch<\/h3>\n<p>Users can turn on the <code>RespectRequiredConstructorParameters<\/code> setting globally using the <code>System.Text.Json.Serialization.RespectRequiredConstructorParametersDefault<\/code> feature switch, which can be set via your project configuration:<\/p>\n<pre><code class=\"language-xml\">&lt;ItemGroup&gt;\n  &lt;RuntimeHostConfigurationOption Include=\"System.Text.Json.Serialization.RespectRequiredConstructorParametersDefault\" Value=\"true\" \/&gt;\n&lt;\/ItemGroup&gt;<\/code><\/pre>\n<p>Both the <code>RespectNullableAnnotations<\/code> and <code>RespectRequiredConstructorParameter<\/code> properties were implemented as opt-in flags to avoid breaking existing applications. If you&#8217;re writing a new application, it is highly recommended that you enable both flags in your code.<\/p>\n<h2>Customizing enum member names<\/h2>\n<p>The new <code>JsonStringEnumMemberName<\/code> attribute can be used to customize the names of individual enum members for types that are serialized as strings:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializer.Serialize(MyEnum.Value1 | MyEnum.Value2); \/\/ \"Value1, Custom enum value\"\n\n[Flags, JsonConverter(typeof(JsonStringEnumConverter))]\nenum MyEnum\n{\n    Value1 = 1,\n    [JsonStringEnumMemberName(\"Custom enum value\")]\n    Value2 = 2,\n}<\/code><\/pre>\n<h2>Out-of-order metadata reads<\/h2>\n<p>Certain features of System.Text.Json such as polymorphism or <code>ReferenceHandler.Preserve<\/code> require emitting metadata properties over the wire:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = new() { ReferenceHandler = ReferenceHandler.Preserve };\nBase value = new Derived(\"Name\");\nJsonSerializer.Serialize(value, options); \/\/ {\"$id\":\"1\",\"$type\":\"derived\",\"Name\":\"Name\"}\n\n[JsonDerivedType(typeof(Derived), \"derived\")]\nrecord Base;\nrecord Derived(string Name) : Base;<\/code><\/pre>\n<p>By default, the STJ metadata reader requires that the metadata properties <code>$id<\/code> and <code>$type<\/code> must be defined at the start of the JSON object:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializer.Deserialize&lt;Base&gt;(\"\"\"{\"Name\":\"Name\",\"$type\":\"derived\"}\"\"\");\n\/\/ JsonException: The metadata property is either not supported by the\n\/\/ type or is not the first property in the deserialized JSON object.<\/code><\/pre>\n<p>This is known to create problems when needing to deserialize JSON payloads that do not originate from System.Text.Json. The new <code>AllowOutOfOrderMetadataProperties<\/code> can be configured to disable this restriction:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = new() { AllowOutOfOrderMetadataProperties = true };\nJsonSerializer.Deserialize&lt;Base&gt;(\"\"\"{\"Name\":\"Name\",\"$type\":\"derived\"}\"\"\", options); \/\/ Success<\/code><\/pre>\n<p>Care should be taken when enabling this flag, as it might result in over-buffering (and OOM failures) when performing streaming deserialization of very large JSON objects. This is because metadata properties must be read <em>before<\/em> the deserialize object is instantiated, meaning that all properties preceding a <code>$type<\/code> property must be kept in the buffer for subsequent property binding.<\/p>\n<h2>Customizing indentation<\/h2>\n<p>The <code>JsonWriterOptions<\/code> and <code>JsonSerializerOptions<\/code> types now expose APIs for configuring indentation. The following example enables single-tab indentation:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = new()\n{\n    WriteIndented = true,\n    IndentCharacter = '\\t',\n    IndentSize = 1,\n};\n\nJsonSerializer.Serialize(new { Value = 42 }, options);<\/code><\/pre>\n<h2><code>JsonObject<\/code> property order manipulation<\/h2>\n<p>The <code>JsonObject<\/code> type is part of the mutable DOM and is used to represent JSON objects. Even though the type is modelled as an <code>IDictionary&lt;string, JsonNode&gt;<\/code>, it does encapsulate an implicit property order that is not user-modifiable. The new release exposes additional APIs that effectively model the type as an ordered dictionary:<\/p>\n<pre><code class=\"language-csharp\">public partial class JsonObject : IList&lt;KeyValuePair&lt;string, JsonNode?&gt;&gt;\n{\n    public int IndexOf(string key);\n    public void Insert(int index, string key, JsonNode? value);\n    public void RemoveAt(int index);\n}<\/code><\/pre>\n<p>This allows modifications to object instances that can directly influence property order:<\/p>\n<pre><code class=\"language-csharp\">\/\/ Adds or moves the $id property to the start of the object\nvar schema = (JsonObject)JsonSerializerOptions.Default.GetJsonSchemaAsNode(typeof(MyPoco));\nswitch (schema.IndexOf(\"$id\", out JsonNode? idValue))\n{\n    case &lt; 0: \/\/ $id property missing\n       idValue = (JsonNode)\"https:\/\/example.com\/schema\";\n       schema.Insert(0, \"$id\", idValue);\n       break;\n\n    case 0: \/\/ $id property already at the start of the object\n        break; \n\n    case int index: \/\/ $id exists but not at the start of the object\n        schema.RemoveAt(index);\n        schema.Insert(0, \"$id\", idValue);\n}<\/code><\/pre>\n<h2><code>DeepEquals<\/code> methods in <code>JsonElement<\/code> and <code>JsonNode<\/code><\/h2>\n<p>The new <code>JsonElement.DeepEquals<\/code> method extends deep equality comparison to <code>JsonElement<\/code> instances, complementing the pre-existing <code>JsonNode.DeepEquals<\/code> method. Additionally, both methods include refinements in their implementation, such as handling of equivalent JSON numeric representations:<\/p>\n<pre><code class=\"language-csharp\">JsonElement left = JsonDocument.Parse(\"10e-3\").RootElement;\nJsonElement right = JsonDocument.Parse(\"0.001\").RootElement;\nJsonElement.DeepEquals(left, right); \/\/ True<\/code><\/pre>\n<h2><code>JsonSerializerOptions.Web<\/code><\/h2>\n<p>The new <code>JsonSerializerOptions.Web<\/code> singleton can be used to quickly serialize values using <code>JsonSerializerDefaults.Web<\/code> settings:<\/p>\n<pre><code class=\"language-csharp\">JsonSerializerOptions options = JsonSerializerOptions.Web; \/\/ used instead of new(JsonSerializerDefaults.Web);\nJsonSerializer.Serialize(new { Value = 42 }, options); \/\/ {\"value\":42}<\/code><\/pre>\n<h2>Performance improvements<\/h2>\n<p>For a detailed write-up of System.Text.Json performance improvements in .NET 9, please refer to the <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/performance-improvements-in-net-9\/#json\">relevant section<\/a> in Stephen Toub\u2019s &#8220;Performance Improvements in .NET 9&#8221; article.<\/p>\n<h2>Closing<\/h2>\n<p>.NET 9 sees a large number of new features and quality of life improvements with a focus on JSON schema and intelligent application support. In total <a href=\"https:\/\/github.com\/dotnet\/runtime\/pulls?q=is:pr+is:merged+label:area-System.Text.Json+milestone:9.0.0\">46 pull requests<\/a> contributed to System.Text.Json during .NET 9 development. We&#8217;d like you to try the new features and give us feedback on how it improves your applications, and any usability issues or bugs that you might encounter.<\/p>\n<p>Community contributions are always welcome. If you&#8217;d like to contribute to System.Text.Json, check out our list of <a href=\"https:\/\/github.com\/dotnet\/runtime\/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+label%3Aarea-System.Text.Json\"><code>help wanted<\/code> issues<\/a> on GitHub.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An overview of all new .NET 9 features in System.Text.Json for developers.<\/p>\n","protected":false},"author":103213,"featured_media":54082,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685,7590],"tags":[7797,7223],"class_list":["post-54023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","category-json","tag-dotnet-9","tag-system-text-json"],"acf":[],"blog_post_summary":"<p>An overview of all new .NET 9 features in System.Text.Json for developers.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/54023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/103213"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=54023"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/54023\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/54082"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=54023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=54023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=54023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}