Thomas Levesque 6/27/2020

Exposing a custom type as a JSON string in an ASP.NET Core API

Read Original

This technical article demonstrates methods to expose a custom C# type (like a Duration struct) as a concise JSON string in an ASP.NET Core API. It compares using JSON.NET's automatic TypeConverter support with creating a custom JsonConverter for System.Text.Json to achieve cleaner, more readable serialization output, such as converting a verbose object into a compact ISO 8601 format string.

Exposing a custom type as a JSON string in an ASP.NET Core API

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week