A System.Text.Json converter to serialize/deserialize a JSON node as a string

How to deserialize a part of JSON as a string keeping everything inside as is including the formatting? Or how to merge JSONs together into one having them provided as strings? The article shows an implement of a custom converter for the System.Text.Json that does described things, and provides additional cases when such converter might be useful.

A custom Json.NET converter

Sometimes, the incoming data in JSON has some custom form that is not supported by the built-in Json.NET converters. In this article, as an educational example, we will implement a custom converter from the UNIX time format in milliseconds to the native .NET class DateTime.

Polymorphic serialization using Json.NET in HttpContent

Imagine a quite common client-server application where the server exposes REST methods and the client communicates using HTTP requests. Requests and responses are serialized in JSON format. There might be a problem if you try to send and receive a DTO that contains a collection of interfaces or abstract classes. I will talk about the usage of Web API and Newtonsoft Json.NET as its underlying serialization library.