Class SystemTextJsonJobInputSerializer
The default IJobInputSerializer: a job's input as JSON, written by JsonSerializer.
public sealed class SystemTextJsonJobInputSerializer : IJobInputSerializer
- Inheritance
-
SystemTextJsonJobInputSerializer
- Implements
- Inherited Members
Remarks
Built exactly as SystemTextJsonObjectSerializer is, so the two agree about what a
scheduler's JSON means, and reading and writing go through the GetTypeInfo overloads that
carry neither RequiresUnreferencedCode nor RequiresDynamicCode — which is what keeps
typed input out of TrimAnalysisBaseline.cs and working in a trimmed or natively compiled
application.
An application published with reflection-based serialization switched off declares its own payload types through AddTypeInfoResolver(IJsonTypeInfoResolver), exactly as it declares a job data value type; there is no second registration to learn.
Constructors
SystemTextJsonJobInputSerializer()
Creates a serializer that knows the built-in types only.
public SystemTextJsonJobInputSerializer()
SystemTextJsonJobInputSerializer(SystemTextJsonSerializerRegistry)
Creates a serializer that resolves payload metadata through the given registry, so a scheduler's own declared types are known to its own serializer and to no other.
public SystemTextJsonJobInputSerializer(SystemTextJsonSerializerRegistry registry)
Parameters
registrySystemTextJsonSerializerRegistry
Methods
Deserialize<TInput>(string)
Reads back what Serialize(object) wrote.
public TInput? Deserialize<TInput>(string payload)
Parameters
payloadstring
Returns
- TInput
Type Parameters
TInput
Serialize(object)
Writes the input as JSON.
public string Serialize(object input)
Parameters
inputobject
Returns
Remarks
Written as object, so the payload describes the runtime type rather than whatever static type the caller happened to hold — the same choice Serialize<T>(T) makes, for the same reason.