The JsonConverter wraps the provided serializers, deserializers and/or stringifiers and revivers into a utility
object which can convert between JSON and a given TypeScript type, providing a unified API which also handles lists.
Remember that, when all is said and done, parsing JSON into typed objects relies on a type assertion. If the server
does not actually provide the data the deserializers claim it does, there's nothing neither the compiler, nor the
runtime, can do about it. So the type provided by this utility class is only as strong and correct as the
deserializers given.
An object carrying the wanted reviver, replacer and (de)serializer to handle an object type.
When serializing an object, this utility will first transform the object using the given serializer (if any), and
then JSON.stringify the transformed object using the given replacer (if any).
Conversely, when deserializing an object, the utility will first JSON.parse the JSON using the given reviver
(if any), and then transform the resulting object using the given deserializer (if any).
The
JsonConverter
wraps the provided serializers, deserializers and/or stringifiers and revivers into a utility object which can convert between JSON and a given TypeScript type, providing a unified API which also handles lists.Remember that, when all is said and done, parsing JSON into typed objects relies on a type assertion. If the server does not actually provide the data the deserializers claim it does, there's nothing neither the compiler, nor the runtime, can do about it. So the type provided by this utility class is only as strong and correct as the deserializers given.