How To

Modifying Date Format for JSON Serialization in C#
By Tan Lee Published on Feb 05, 2025 922

When serializing a DateTime object using the System.Text.Json library in C#, the default date format used is the ISO-8601 standard (e.g., 2022-01-31T13:15:05.2151663-05:00).

Serialize anonymous types with System.Text.Json in C#
By Tan Lee Published on Feb 05, 2025 661

In C#, you can use the System.Text.Json library to serialize anonymous types by selecting properties from an existing object and serializing them into a JSON string.

Serialize to JSON in Alphabetical Order in C#
By Tan Lee Published on Feb 05, 2025 701

There are two ways to serialize an object’s properties to JSON in alphabetical order using System.Text.Json:

Ignore null properties during JSON serialization in C#
By Tan Lee Published on Feb 05, 2025 1.28K

By default, null properties are included in JSON serialization.

Property order with System.Text.Json in C#
By Tan Lee Published on Feb 05, 2025 373

In C#, you can control the order in which properties are serialized using the JsonPropertyOrder attribute.

How to Convert an object to JSON in C#
By Tan Lee Published on Feb 05, 2025 315

To convert an object to JSON in C#, you can use either System.Text.Json (built-in in .NET) or Newtonsoft.Json (a popular third-party library).

How to Convert JSON to an object in C#
By Tan Lee Published on Feb 05, 2025 344

In C#, converting a JSON string into an object is known as deserialization.

How to get temp folder path in C#
By Tan Lee Published on Dec 25, 2024 687

In C#, you can easily access and work with temporary folders and files using the System.IO.Path class.

How to Get and send JSON using HttpClient in C#
By Tan Lee Published on Jan 22, 2025 688

Handling JSON data in C# is an essential part of modern web development, and HttpClient provides a straightforward way to interact with APIs that return or require JSON.

How to replace a file in C#
By Tan Lee Published on Jun 12, 2024 1K

Replacing a file in C# can be done using the System.IO namespace, which provides classes for working with files and directories.

How to Convert WebP to JPEG in C#
By Tan Lee Published on Jan 10, 2025 754

WebP is a modern image format developed by Google, offering superior compression and quality compared to older formats like JPEG and PNG.

How to remove HTML tags from string in C#
By Tan Lee Published on Jan 09, 2025 1K

In this post, we will explore how to remove HTML tags from a string in C#.