Search

Deserialize JSON to a dictionary in C#
By Tan Lee Published on Feb 05, 2025 740

To deserialize JSON into a dictionary in C#, you can use the built-in JsonSerializer.Deserialize() method from the System.Text.Json namespace or use JsonConvert.DeserializeObject() from the popular Newtonsoft.Json library.

Read more
Deserialize a JSON array to a list in C#
By Tan Lee Published on Feb 05, 2025 692

To deserialize a JSON array into a list in C#, you can use the JsonSerializer class from the System.Text.Json namespace.

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

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).

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

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.

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

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

Read more
Ignore null properties during JSON serialization in C#
By Tan Lee Published on Feb 05, 2025 962

By default, null properties are included in JSON serialization.

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

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

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

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).

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

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

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

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

Read more