Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Tag: System.Text.Json

Asp.Net Core

Asp.Net Core: Fix Minimal API Model Binding Silently Dropping a Misspelled JSON Field Instead of Raising Any Error at All

- 14.11.26 - ErcanOPAK comment on Asp.Net Core: Fix Minimal API Model Binding Silently Dropping a Misspelled JSON Field Instead of Raising Any Error at All

⚙️ Fix Minimal API Model Binding Silently Dropping a Misspelled JSON Field Instead of Raising Any Error at All System.Text.Json, which Minimal APIs use by default for request body binding, ignores any JSON property that doesn’t match a member on the target type unless explicitly configured otherwise. That’s a deliberate, generally reasonable default for tolerating […]

Read More
Asp.Net Core

Asp.Net Core: Fix a Minimal API’s [FromBody] Parameter Deserializing With Every Property Null Because the Client Sends PascalCase Field Names While a Custom JsonNamingPolicy Expects camelCase

- 11.11.26 - ErcanOPAK comment on Asp.Net Core: Fix a Minimal API’s [FromBody] Parameter Deserializing With Every Property Null Because the Client Sends PascalCase Field Names While a Custom JsonNamingPolicy Expects camelCase

⚙️ Asp.Net Core: Fix a Minimal API’s [FromBody] Parameter Deserializing With Every Property Null Because the Client Sends PascalCase Field Names While a Custom JsonNamingPolicy Expects camelCase ASP.NET Core’s default Minimal API JSON configuration uses camelCase property matching unless something explicitly overrides it, but a project that configures its own JsonSerializerOptions to match a different […]

Read More
Asp.Net Core

ASP.NET Core: Fix a Minimal API Deserializing a Missing Property Into null Instead of Failing Because the Record’s Property Is Non-Nullable but Never Marked required

- 08.11.26 - ErcanOPAK comment on ASP.NET Core: Fix a Minimal API Deserializing a Missing Property Into null Instead of Failing Because the Record’s Property Is Non-Nullable but Never Marked required

⚙️ ASP.NET Core: Fix a Minimal API Deserializing a Missing Property Into null Instead of Failing Because the Record’s Property Is Non-Nullable but Never Marked required System.Text.Json’s awareness of nullable reference types is NOT part of ordinary deserialization — a record or class property declared as a plain non-nullable reference type, without the C# 11 […]

Read More
C#

C#: Fix a Polymorphic System.Text.Json Payload That Silently Serializes Without the Derived Type’s Discriminator

- 16.10.26 - ErcanOPAK comment on C#: Fix a Polymorphic System.Text.Json Payload That Silently Serializes Without the Derived Type’s Discriminator

🔧 The Polymorphic Payload That Serialized Into Amnesia System.Text.Json serializes a value based on its declared (compile-time) type by default, not its actual runtime type – so a List of Animal holding real Dog and Cat instances gets serialized using only the members defined on Animal itself, with every derived-only property silently dropped and no […]

Read More
Asp.Net Core

ASP.NET Core: Fix a Custom JsonConverter That Never Runs Because It Was Registered on the Wrong JsonSerializerOptions Instance

- 10.10.26 - ErcanOPAK comment on ASP.NET Core: Fix a Custom JsonConverter That Never Runs Because It Was Registered on the Wrong JsonSerializerOptions Instance

⚙️ The Converter That’s Registered on the Wrong Options Object System.Text.Json resolves converters from the JsonSerializerOptions instance that’s actually used for a given serialize or deserialize call, and ASP.NET Core creates more than one of these under the hood: the one wired into AddControllers().AddJsonOptions(…) only governs MVC controller request and response bodies, while minimal API […]

Read More
Asp.Net Core

ASP.NET Core: Fix Model Binding That Silently Returns Null for a Perfectly Valid Request Body

- 31.08.26 - ErcanOPAK comment on ASP.NET Core: Fix Model Binding That Silently Returns Null for a Perfectly Valid Request Body

⚙️ The Request Body Looks Perfect – The Model Still Comes Back Null You POST a well-formed JSON body to an endpoint, ModelState.IsValid says true, and yet the parameter your action method receives is null or has every property at its default value – no error, no exception, just quietly wrong data. 🐞 The Problem […]

Read More
C#

C#: System.Text.Json vs Newtonsoft.Json Performance

- 18.08.26 - ErcanOPAK comment on C#: System.Text.Json vs Newtonsoft.Json Performance

⚡ System.Text.Json = Performance JSON serialization is everywhere. System.Text.Json vs Newtonsoft.Json performance comparison. 📝 Serialization Performance [MemoryDiagnoser] public class JsonSerializationBenchmark { private readonly User _user = new User { Id = 1, Name = “John Doe”, Email = “john@example.com”, CreatedAt = DateTime.UtcNow, Roles = new[] { “Admin”, “User” } }; [Benchmark] public string SystemTextJson_Serialize() { […]

Read More
C#

C#: Use Utf8JsonReader for Maximum JSON Parsing Performance

- 21.02.26 - ErcanOPAK comment on C#: Use Utf8JsonReader for Maximum JSON Parsing Performance

JsonSerializer.Deserialize is convenient but allocates. Utf8JsonReader parses JSON with zero allocation. Standard Way (Allocates): var user = JsonSerializer.Deserialize(json); // Creates User object + all strings + intermediates Utf8JsonReader (Zero-Allocation): using System.Text.Json; var reader = new Utf8JsonReader(jsonBytes); string name = null; int age = 0; while (reader.Read()) { if (reader.TokenType == JsonTokenType.PropertyName) { var propertyName = […]

Read More
November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (981)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (653)
  • Add Constraint to SQL Table to ensure email contains @ (609)
  • Average of all values in a column that are not zero in SQL (570)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (547)
  • Find numbers with more than two decimal places in SQL (475)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit
  • SQL Server: Fix ROW_NUMBER Ties Reordering Between Identical Runs
  • C#: Fix an Enum HasFlag Returning True for the Zero Value
  • WordPress: Fix Featured Images Vanishing After a CDN Migration
  • Photoshop: Fix Content-Aware Fill Smearing a Repeating Pattern
  • Asp.Net Core: Fix Antiforgery Tokens Rejected Behind a Reverse Proxy

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (981)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com