Class IronLedgerJsonSerializer
- Namespace
- Tudormobile.IronLedgerLib.Serialization
- Assembly
- Tudormobile.IronLedgerLib.dll
Default JSON-based implementation of IIronLedgerSerializer.
public class IronLedgerJsonSerializer : IIronLedgerSerializer
- Inheritance
-
IronLedgerJsonSerializer
- Implements
- Inherited Members
Remarks
Uses System.Text.Json with configured options for consistent serialization of IronLedger types.
Constructors
IronLedgerJsonSerializer()
Initializes a new instance of the IronLedgerJsonSerializer class with default options.
public IronLedgerJsonSerializer()
IronLedgerJsonSerializer(JsonSerializerOptions)
Initializes a new instance of the IronLedgerJsonSerializer class with custom options.
public IronLedgerJsonSerializer(JsonSerializerOptions options)
Parameters
optionsJsonSerializerOptionsCustom JSON serializer options.
Properties
ContentType
Gets the MIME content type produced by this serializer (e.g. application/json).
public string ContentType { get; }
Property Value
Methods
CreateDefaultOptions()
Creates default JSON serializer options configured for IronLedger types.
public static JsonSerializerOptions CreateDefaultOptions()
Returns
- JsonSerializerOptions
Configured JsonSerializerOptions.
Deserialize<T>(string)
Deserializes a string representation to an object.
public T? Deserialize<T>(string data)
Parameters
datastringThe string representation to deserialize.
Returns
- T
The deserialized object. Some implementations may return null if deserialization fails, while others may throw an exception (for example, when the input is invalid for the chosen serialization format).
Type Parameters
TThe type of object to deserialize.
Serialize<T>(T)
Serializes an object to a string representation.
public string Serialize<T>(T value)
Parameters
valueTThe value to serialize.
Returns
- string
A string representation of the object.
Type Parameters
TThe type of object to serialize.