{"id":1343,"date":"2025-04-16T00:00:00","date_gmt":"2025-04-15T22:00:00","guid":{"rendered":"https:\/\/demo.sidekick.be\/itenium\/dotnet-json\/"},"modified":"2025-11-28T13:31:41","modified_gmt":"2025-11-28T12:31:41","slug":"dotnet-json","status":"publish","type":"post","link":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/","title":{"rendered":"Newtonsoft.Json vs System.Text.Json"},"content":{"rendered":"<p>System.Text.Json is included in the runtime for .NET Core 3.1 and later. Otherwise use the <a href=\"https:\/\/www.nuget.org\/packages\/System.Text.Json\">nuget package<\/a>.<\/p>\n<h1 id=\"tldr\">TL&amp;DR<\/h1>\n<ul>\n<li><strong>System.Text.Json<\/strong>: The default, fast, memory efficient, but basic features<\/li>\n<li><strong>Newtonsoft.Json<\/strong>: Easy, tolerant, lots of features, but much slower<\/li>\n<\/ul>\n<h1 id=\"basic-usage\">Basic Usage<\/h1>\n<p>(De)Serialization with optional settings\/options:<\/p>\n<pre><code class=\"language-csharp\">\/\/ System.Text.Json\nvar options = new JsonSerializerOptions();\nstring json = JsonSerializer.Serialize(obj[, options]);\nMyClass? obj = JsonSerializer.Deserialize&lt;MyClass&gt;(json[, options]);\n\n\/\/ Newtonsoft.Json\nvar settings = new JsonSerializerSettings();\nstring json = JsonConvert.SerializeObject(obj[, settings]);\nMyClass? obj = JsonConvert.DeserializeObject&lt;MyClass&gt;(json[, settings]);\n<\/code><\/pre>\n<h1 id=\"configuration\">Configuration<\/h1>\n<table class=\"table-code\">\n<thead>\n<tr>\n<th><\/th>\n<th>System.Text.Json<\/th>\n<th>Newtonsoft.Json<\/th>\n<th>Remarks<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Type<\/td>\n<td>JsonSerializerOptions<\/td>\n<td>JsonSerializerSettings<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>DefaultIgnoreCondition<\/td>\n<td><em>separate properties<\/em><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Default<\/td>\n<td>JsonIgnoreCondition.WhenWritingDefault<\/td>\n<td>DefaultValueHandling<\/td>\n<td>Skip default(T)<\/td>\n<\/tr>\n<tr>\n<td>Null<\/td>\n<td>JsonIgnoreCondition.WhenWritingNull<\/td>\n<td>NullValueHandling<\/td>\n<td>Skip null only<\/td>\n<\/tr>\n<tr>\n<td>Pretty Print<\/td>\n<td>WriteIndented, IndentCharacter, IndentSize, NewLine<\/td>\n<td>Formatting<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Numbers<\/td>\n<td>NumberHandling<\/td>\n<td>FloatFormatHandling<\/td>\n<td>See Floats<\/td>\n<\/tr>\n<tr>\n<td>Dates<\/td>\n<td><em>custom converters<\/em><\/td>\n<td>DateFormatString, DateFormatHandling, DateTimeZoneHandling, DateParseHandling<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Circular Refs<\/td>\n<td>ReferenceHandler<\/td>\n<td>ReferenceLoopHandling<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Unexisting properties<\/td>\n<td>UnmappedMemberHandling<\/td>\n<td>MissingMemberHandling<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>Constructor<\/td>\n<td>RespectRequiredConstructorParameters<\/td>\n<td>ConstructorHandling<\/td>\n<td><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"floats\">Floats<\/h2>\n<p>Serialize float\/double NaN, Infinity and -Infinity as strings.<\/p>\n<pre><code class=\"language-csharp\">\/\/ System.Text.Json\nvar opts = new JsonSerializerOptions()\n{\n  NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals,\n  \/\/ JsonNumberHandling.Strict (default): Throw ArgumentException for NaN etc\n};\nvar obj = new Floats() { Float = 3.1415f, Float2 = float.NaN };\nstring json = JsonSerializer.Serialize(obj, opts);\nAssert.Equal(\"{\"Float\":3.1415,\"Float2\":\"NaN\"}\", json);\n\n\/\/ Serialize all values as strings\nopts = new JsonSerializerOptions()\n{\n  NumberHandling = JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString\n};\nobj = new Floats() { Float = 3.1415f, Float2 = float.PositiveInfinity};\njson = JsonSerializer.Serialize(obj, opts);\nAssert.Equal(\"{\"Float\":\"3.1415\",\"Float2\":\"Infinity\"}\", json);\n\n\n\/\/ Newtonsoft.Json\nvar sets = new JsonSerializerSettings()\n{\n  \/\/ \"String\" is the default behavior:\n  FloatFormatHandling = FloatFormatHandling.String,\n  \/\/ FloatFormatHandling.DefaultValue: Serialize NaN etc as 0.0\n  \/\/ FloatFormatHandling.Symbol: Serialize NaN etc WITHOUT quotes (=not valid json)\n};\nvar obj = new Floats() { Float = 3.1415f, Float2 = float.NegativeInfinity };\nstring json = JsonConvert.SerializeObject(obj, sets);\nAssert.Equal(\"{\"Float\":3.1415,\"Float2\":\"-Infinity\"}\", json);\n\n\/\/ Newtonsoft can also serialize ALL floats as a string with a custom converter\nvar settings = new JsonSerializerSettings\n{\n  Converters = new List&lt;JsonConverter&gt; { new StringFloatConverter() },\n};\n\npublic class StringFloatConverter : JsonConverter\n{\n  public override bool CanConvert(Type objectType) =&gt; objectType == typeof(float);\n\n  public override object ReadJson(JsonReader reader, Type objType, object value, JsonSerializer serializer)\n  {\n    if (reader.TokenType == JsonToken.String)\n      return float.Parse((string)reader.Value);\n\n    return Convert.ToDouble(reader.Value);\n  }\n\n  public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)\n  {\n    writer.WriteValue(((float)value).ToString(CultureInfo.InvariantCulture));\n  }\n}\n<\/code><\/pre>\n<h2 id=\"default-options\">Default Options<\/h2>\n<p>Only for Newtonsoft:<\/p>\n<pre><code class=\"language-csharp\">JsonConvert.DefaultSettings = () =&gt; new JsonSerializerSettings {};\n\n\/\/ Read-only for STJ:\nvar defaultOpts = JsonSerializerOptions.Default;\n<\/code><\/pre>\n<h1 id=\"performance\">Performance<\/h1>\n<h2 id=\"case-sensitivity\">Case Sensitivity<\/h2>\n<p>One of the reasons System.Text.Json is so much more performant is because Newtonsoft json key names are completely case insensitive, while property name cases have to match exactly in STJ.<\/p>\n<pre><code class=\"language-csharp\">public record Person(string Name);\n\n\/\/ System.Text.Json\nstring json = \"{\"name\":\"Bert\"}\";\nvar obj = JsonSerializer.Deserialize&lt;Person&gt;(json);\nAssert.Null(obj.Name);\n\n\/\/ Newtonsoft.Json\nstring json = \"{\"name\":\"Bert\"}\";\nvar obj = JsonConvert.DeserializeObject&lt;Person&gt;(json);\nAssert.Equal(\"Bert\", obj.Name);\n<\/code><\/pre>\n<h2 id=\"postels-law\">Postel\u2019s law<\/h2>\n<p class=\"notice--info\">Be conservative in what you send, be liberal in what you accept.<\/p>\n<p>Newtonsoft.Json is <strong>very<\/strong> liberal in what it will deserialize for you without complaint.<\/p>\n<pre><code class=\"language-csharp\">string json = \"\"\"\n{\n  \/\/ Newtonsoft parses this\n  Name: 'Bert',\n}\n\"\"\";\n<\/code><\/pre>\n<p>While System.Text.Json throws a <code>JsonException<\/code> on:<\/p>\n<ul>\n<li>The comment<\/li>\n<li>The missing quotes around Name<\/li>\n<li>The use of single quotes around Bert<\/li>\n<li>The extra comma after \u2018Bert\u2019<\/li>\n<\/ul>\n<p>Some of these can still be parsed by STJ with some extra configuration:<\/p>\n<pre><code class=\"language-csharp\">var opts = new JsonSerializerOptions()\n{\n  PropertyNameCaseInsensitive = true,\n  ReadCommentHandling = JsonCommentHandling.Skip,\n  AllowTrailingCommas = true,\n};\n<\/code><\/pre>\n<h2 id=\"spanof-t\">Span(Of T)<\/h2>\n<p>The main reason for the performance difference however is the use of <code>Span&lt;T&gt;<\/code> in System.Text.Json. Which is not being adopted by Newtonsoft because of .NET Framework support.<\/p>\n<p>Performance is about 2x but this increases to about 3x for serialization when using the STJ <a href=\"https:\/\/devblogs.microsoft.com\/dotnet\/introducing-c-source-generators\/\">source generation<\/a> feature to eliminate the use of Reflection.<\/p>\n<h1 id=\"webapi\">WebApi<\/h1>\n<p>System.Text.Json is the default from .NET Core 3.1 and up.<\/p>\n<p>I\u2019ve added the same \u201csensible\u201d configuration for both:<\/p>\n<ul>\n<li>Use camelCase for property names \u2013 which is typically used in JavaScript<\/li>\n<li>During development, pretty print the json<\/li>\n<li>Do not include <code>null<\/code> and primitive default values (ex: <code>false<\/code>, <code>0<\/code>) in the output so the bytes sent over the network are somewhat reduced<\/li>\n<li>Serialize enums as strings. While this increases the bytes sent, it does make them more human-readable.<\/li>\n<\/ul>\n<pre><code class=\"language-csharp\">var builder = WebApplication.CreateBuilder(args);\n\n\/\/ System.Text.Json\nbuilder.Services.AddControllers().AddJsonOptions(options =&gt;\n{\n  options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;\n\n  if (builder.Environment.IsDevelopment())\n    options.JsonSerializerOptions.WriteIndented = true;\n\n  options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault;\n  options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());\n});\n\n\/\/ System.Text.Json for Minimal APIs (.NET Core 7)\nbuilder.Services.ConfigureHttpJsonOptions(options =&gt; { ... });\n\/\/ If not specified, defaults to:\nvar opts = new JsonSerializerOptions(JsonSerializerDefaults.Web);\nAssert.True(opts.PropertyNameCaseInsensitive);\nAssert.Equal(JsonNamingPolicy.CamelCase, opts.PropertyNamingPolicy);\nAssert.Equal(JsonNumberHandling.AllowReadingFromString, opts.NumberHandling);\n\n\n\/\/ Newtonsoft.Json\nInstall-Package Microsoft.AspNetCore.Mvc.NewtonsoftJson\n\nusing Newtonsoft.Json.Serialization;\nbuilder.Services.AddControllers().AddNewtonsoftJson(options =&gt;\n{\n  options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();\n\n  if (builder.Environment.IsDevelopment())\n    options.SerializerSettings.Formatting = Formatting.Indented;\n\n  options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore;\n  options.SerializerSettings.DefaultValueHandling = DefaultValueHandling.Ignore;\n  options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter());\n});\n<\/code><\/pre>\n<h1 id=\"custom-converters\">Custom Converters<\/h1>\n<p>When the serialization options\/settings can\u2019t handle your case, maybe because you cannot control how the json communication happens or because some values should be converted to a domain specific type, you can add your own converters.<\/p>\n<p>Imagine that our frontend sends and\/or accepts Money in a specific culture, like <code>15.000,99<\/code> (nl-BE formatting).<\/p>\n<h2 id=\"stj-culturalmoney\">STJ CulturalMoney<\/h2>\n<p>For illustration purposes only; you\u2019ll probably want to handle all sorts of edge cases \ud83d\ude09<\/p>\n<pre><code class=\"language-csharp\">new JsonSerializerOptions().Converters.Add(new CulturalMoneyConverter(new CultureInfo(\"nl-BE\")));\n\npublic class CulturalMoneyConverter(CultureInfo culture) : JsonConverter&lt;decimal&gt;\n{\n  public override decimal Read(ref Utf8JsonReader reader, Type toConvert, JsonSerializerOptions opts)\n  {\n    return reader.TokenType == JsonTokenType.String\n      ? decimal.Parse(reader.GetString(), NumberStyles.Any, culture)\n      : reader.GetDecimal();\n  }\n\n  public override void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options)\n  {\n    writer.WriteStringValue(value.ToString(\"#,###.##\", culture));\n  }\n}\n<\/code><\/pre>\n<h2 id=\"newtonsoft-culturalmoney\">Newtonsoft CulturalMoney<\/h2>\n<pre><code class=\"language-csharp\">new JsonSerializerSettings().Converters.Add(new CulturalMoneyConverter(new CultureInfo(\"nl-BE\")));\n\npublic class CulturalMoneyConverter(CultureInfo culture) : Newtonsoft.Json.JsonConverter\n{\n  public override bool CanConvert(Type objectType) =&gt; objectType == typeof(decimal);\n\n  public override object ReadJson(JsonReader reader, Type objType, object? value, JsonSerializer js)\n  {\n    return reader.TokenType == JsonToken.String\n      ? decimal.Parse((string)reader.Value, NumberStyles.Any, culture)\n      : Convert.ToDecimal(reader.Value);\n  }\n\n  public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)\n  {\n    writer.WriteValue(((decimal)value).ToString(\"#,###.##\", culture));\n  }\n}\n<\/code><\/pre>\n<h2 id=\"contract-resolvers\">Contract Resolvers<\/h2>\n<p>If converters aren\u2019t doing it for you, because your frontend team is sending some really weird stuff, it\u2019s still possible to further alter the behavior of serialization.<\/p>\n<p>In STJ this is done by setting the <code>JsonSerializerOptions.TypeInfoResolver<\/code>, where you could use <code>new DefaultJsonTypeInfoResolver()<\/code> and set the <code>Modifiers<\/code> property or provide custom implementation(s) with <code>JsonTypeInfoResolver.Combine(...)<\/code>.<\/p>\n<p>For Newtonsoft, set the <code>JsonSerializerSettings.ContractResolver<\/code> and inherit from the <code>DefaultContractResolver<\/code>.<\/p>\n<h1 id=\"adoption\">Adoption<\/h1>\n<p><a href=\"https:\/\/nugettrends.com\/packages?ids=System.Text.Json&amp;ids=Newtonsoft.Json&amp;months=120\">Adoption for both libraries is going up<\/a>, with no decline in sight for Newtonsoft.Json but I\u2019m guessing this is comparing apples and oranges because STJ is included by default and is thus under-represented in the graph.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/itenium-be.github.io\/blog-posts-new\/assets\/blog-images\/dotnet-json-trend.png\" alt=\"Newtonsoft.Json vs System.Text.Json nuget downloads graph for the last 10 years\" title=\"Nuget downloads comparison\" class=\"img-responsive\" \/><\/p>\n<h1 id=\"more\">More!!<\/h1>\n<h2 id=\"polymorphism\">Polymorphism<\/h2>\n<p>Works pretty much out of the box for Newtonsoft. For STJ it is possible to achieve starting from .NET Core 7 with the <code>JsonDerivedTypeAttribute<\/code> on the base class.<\/p>\n<h2 id=\"attributes\">Attributes<\/h2>\n<p>Both have attributes that can be applied to fields and\/or properties to change serialization behavior without reverting to custom code.<\/p>\n<h3 id=\"stj-attributes\">STJ Attributes<\/h3>\n<pre><code class=\"language-csharp\">public class Person\n{\n  [JsonPropertyName(\"person_name\")]\n  [JsonPropertyOrder(10)]\n  public string Name { get; }\n\n  [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]\n  public int? Age { get; }\n\n  [JsonIgnore]\n  public string Password { get; set; }\n\n  \/\/ We cannot pass a format to the Converter (like Newtonsoft allows)\n  [JsonConverter(typeof(BirthDateFormatConverter))]\n  public DateTime BirthDate { get; }\n\n  [JsonConstructor]\n  public PersonWithAttributes(string name, int? age = null)\n  {\n    Name = name; \/\/ \"person_name\" does NOT work\n    Age = age;\n  }\n}\n<\/code><\/pre>\n<h3 id=\"newtonsoft-attributes\">Newtonsoft Attributes<\/h3>\n<pre><code class=\"language-csharp\">[JsonObject(MemberSerialization.OptOut)]\npublic class PersonWithAttributes\n{\n  [JsonProperty(\"person_name\", Order = 10)]\n  public string Name { get; }\n\n  [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]\n  public int? Age { get; }\n\n  [JsonIgnore]\n  public string Password { get; set; }\n\n  \/\/ Pass the format to the Converter\n  [JsonConverter(typeof(DateFormatConverter), \"yyyy-MM-dd\")]\n  public DateTime BirthDate { get; }\n\n  [JsonConstructor]\n  public PersonWithAttributes(string name, int? age)\n  {\n      Name = name; \/\/ This parameter could also be called person_name\n      Age = age;\n  }\n}\n<\/code><\/pre>\n<h2 id=\"callbacks\">Callbacks<\/h2>\n<p>Execute code before\/after (de)serialization:<\/p>\n<ul>\n<li>STJ: implement interfaces (IJsonOnSerializing, IJsonOnSerialized, IJsonOnDeserializing, IJsonOnDeserialized)<\/li>\n<li>Newtonsoft: attributes on methods (OnSerializing, OnSerialized, OnDeserializing, OnDeserialized)<\/li>\n<\/ul>\n<h1>Extras<\/h1>\n<p><b>Stuff that came into being during the making of this post<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/itenium-be\/DotNet-Json\">The code as xUnit tests<\/a><\/li>\n<\/ul>\n<p><b>Other interesting reads<\/b><\/p>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/standard\/serialization\/system-text-json\/migrate-from-newtonsoft\">Pretty in-depth migration article with a nice comparison table<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dotnet\/runtime\/tree\/main\/src\/libraries\/System.Text.Json\/tests\/System.Text.Json.Tests\/Serialization\">The official STJ test suite<\/a><\/li>\n<\/ul>\n<h1> Package Versions <i class=\"fa fa-info-circle\" style=\"float: right; color: cornflowerblue; font-size: 28px\" title=\"Package versions used for this post and in the accompanying code on Github\"><\/i><\/h1>\n<p> Newtonsoft.Json: v13.0.3 <\/p>\n<p> System.Text.Json: v9.0.4 <\/p>\n","protected":false},"excerpt":{"rendered":"<p><a href=\"https:\/\/github.com\/JamesNK\/Newtonsoft.Json\" class=\"github\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/github\/stars\/JamesNK\/Newtonsoft.Json.svg?style=social&amp;label=Star\" \/><\/a><a href=\"https:\/\/github.com\/JamesNK\/Newtonsoft.Json\">JamesNK\/Newtonsoft.Json<\/a><\/p>\n<p>System.Text.Json (STJ) is about twice as fast as Newtonsoft.Json while only consuming 50% as much memory. A legacy project might still be using Newtonsoft but chances are serialization isn\u2019t a bottleneck so it\u2019s probably not worth making the switch.<\/p>\n<p>For new applications you\u2019ll want to stick with STJ however. Only add the extra nuget if you really need one of the advanced Newtonsoft features (ex: Linq to Json, polymorphic serialization, circular reference handling).<\/p>\n","protected":false},"author":1,"featured_media":1957,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[11],"tags":[6],"class_list":["post-1343","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","tag-tutorial"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Newtonsoft.Json vs System.Text.Json - Itenium<\/title>\n<meta name=\"robots\" content=\"noindex, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Newtonsoft.Json vs System.Text.Json - Itenium\" \/>\n<meta property=\"og:description\" content=\"JamesNK\/Newtonsoft.JsonSystem.Text.Json (STJ) is about twice as fast as Newtonsoft.Json while only consuming 50% as much memory. A legacy project might still be using Newtonsoft but chances are serialization isn\u2019t a bottleneck so it\u2019s probably not worth making the switch.For new applications you\u2019ll want to stick with STJ however. Only add the extra nuget if you really need one of the advanced Newtonsoft features (ex: Linq to Json, polymorphic serialization, circular reference handling).\" \/>\n<meta property=\"og:url\" content=\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/\" \/>\n<meta property=\"og:site_name\" content=\"Itenium\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-15T22:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-28T12:31:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png\" \/>\n\t<meta property=\"og:image:width\" content=\"360\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Usdevelop\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Usdevelop\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/\",\"name\":\"Newtonsoft.Json vs System.Text.Json - Itenium\",\"isPartOf\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png\",\"datePublished\":\"2025-04-15T22:00:00+00:00\",\"dateModified\":\"2025-11-28T12:31:41+00:00\",\"author\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\"},\"breadcrumb\":{\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#primaryimage\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png\",\"contentUrl\":\"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png\",\"width\":360,\"height\":300,\"caption\":\"A sleek, high-tech digital scale balancing two glowing cubes labeled 'Newtonsoft.Json' and 'System.Text.Json', surrounded by abstract data streams and JSON code fragments, futuristic interface design, vibrant lighting, cyberpunk color palette, minimal shadows, modern UI aesthetics\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/demo.sidekick.be\/itenium\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Newtonsoft.Json vs System.Text.Json\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#website\",\"url\":\"https:\/\/demo.sidekick.be\/itenium\/\",\"name\":\"Itenium\",\"description\":\"We build software. We build careers.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022\",\"name\":\"Usdevelop\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g\",\"caption\":\"Usdevelop\"},\"sameAs\":[\"https:\/\/demo.sidekick.be\/itenium\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Newtonsoft.Json vs System.Text.Json - Itenium","robots":{"index":"noindex","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"og_locale":"en_US","og_type":"article","og_title":"Newtonsoft.Json vs System.Text.Json - Itenium","og_description":"JamesNK\/Newtonsoft.JsonSystem.Text.Json (STJ) is about twice as fast as Newtonsoft.Json while only consuming 50% as much memory. A legacy project might still be using Newtonsoft but chances are serialization isn\u2019t a bottleneck so it\u2019s probably not worth making the switch.For new applications you\u2019ll want to stick with STJ however. Only add the extra nuget if you really need one of the advanced Newtonsoft features (ex: Linq to Json, polymorphic serialization, circular reference handling).","og_url":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/","og_site_name":"Itenium","article_published_time":"2025-04-15T22:00:00+00:00","article_modified_time":"2025-11-28T12:31:41+00:00","og_image":[{"width":360,"height":300,"url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png","type":"image\/png"}],"author":"Usdevelop","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Usdevelop","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/","url":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/","name":"Newtonsoft.Json vs System.Text.Json - Itenium","isPartOf":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#website"},"primaryImageOfPage":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#primaryimage"},"image":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#primaryimage"},"thumbnailUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png","datePublished":"2025-04-15T22:00:00+00:00","dateModified":"2025-11-28T12:31:41+00:00","author":{"@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022"},"breadcrumb":{"@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#primaryimage","url":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png","contentUrl":"https:\/\/demo.sidekick.be\/itenium\/wp-content\/uploads\/2025\/11\/dotnet-json.png","width":360,"height":300,"caption":"A sleek, high-tech digital scale balancing two glowing cubes labeled 'Newtonsoft.Json' and 'System.Text.Json', surrounded by abstract data streams and JSON code fragments, futuristic interface design, vibrant lighting, cyberpunk color palette, minimal shadows, modern UI aesthetics"},{"@type":"BreadcrumbList","@id":"https:\/\/demo.sidekick.be\/itenium\/blog\/dotnet\/dotnet-json\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/demo.sidekick.be\/itenium\/"},{"@type":"ListItem","position":2,"name":"Newtonsoft.Json vs System.Text.Json"}]},{"@type":"WebSite","@id":"https:\/\/demo.sidekick.be\/itenium\/#website","url":"https:\/\/demo.sidekick.be\/itenium\/","name":"Itenium","description":"We build software. We build careers.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/demo.sidekick.be\/itenium\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/6ab401ce01e858184ee4a8667fe0f022","name":"Usdevelop","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/demo.sidekick.be\/itenium\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cc8cf9b9e9d5bbe7e8d247907cc9ac8457bbfa2854b52eaddf6529adfe88ceab?s=96&d=mm&r=g","caption":"Usdevelop"},"sameAs":["https:\/\/demo.sidekick.be\/itenium"]}]}},"_links":{"self":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/comments?post=1343"}],"version-history":[{"count":2,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1343\/revisions"}],"predecessor-version":[{"id":2143,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/posts\/1343\/revisions\/2143"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media\/1957"}],"wp:attachment":[{"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/media?parent=1343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/categories?post=1343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demo.sidekick.be\/itenium\/wp-json\/wp\/v2\/tags?post=1343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}