Class SerializationPayloadEditor
- Namespace
- Chronicler
- Assembly
- Chronicler.dll
Provides methods for editing serialized payloads without fully deserializing them.
public static class SerializationPayloadEditor
- Inheritance
-
SerializationPayloadEditor
- Inherited Members
Methods
PopulateRecord(IRecordable, object, bool)
Populates a record with data from a serialized payload (JSON string or MemoryPack byte array) based on the specified options.
public static void PopulateRecord(IRecordable target, object payload, bool useMemoryPack = true)
Parameters
targetIRecordableThe record to populate.
payloadobjectThe serialized payload.
useMemoryPackboolWhether to use MemoryPack for deserialization.
RemoveJsonProperty(string, params string[])
Removes a property from a JSON payload at the specified path.
public static string RemoveJsonProperty(string json, params string[] path)
Parameters
Returns
- string
The modified JSON payload.
Exceptions
RemoveMemoryPackEntry(byte[], params string[])
Removes a MemoryPack entry from a serialized payload at the specified path.
public static byte[] RemoveMemoryPackEntry(byte[] data, params string[] path)
Parameters
Returns
- byte[]
The modified serialized MemoryPack payload.
Exceptions
RemovePayloadEntry(object, bool, params string[])
Removes an entry from a serialized payload (JSON property or MemoryPack entry) at the specified path based on the specified options.
public static object RemovePayloadEntry(object payload, bool useMemoryPack = true, params string[] path)
Parameters
payloadobjectThe serialized payload.
useMemoryPackboolWhether to use MemoryPack for deserialization.
pathstring[]The path to the entry to remove.
Returns
- object
The modified payload.
SerializeRecord(IRecordable, bool)
Serializes a record to a payload format (JSON string or MemoryPack byte array) based on the specified options.
public static object SerializeRecord(IRecordable record, bool useMemoryPack = true)
Parameters
recordIRecordableThe record to serialize.
useMemoryPackboolWhether to use MemoryPack for serialization.
Returns
- object
The serialized payload.
SetJsonValue<T>(string, T, params string[])
Sets a property value in a JSON payload at the specified path.
public static string SetJsonValue<T>(string json, T value, params string[] path)
Parameters
jsonstringThe JSON payload.
valueTThe value to set.
pathstring[]The path to the property to set.
Returns
- string
The modified JSON payload.
Type Parameters
TThe type of the value to set.
Exceptions
SetMemoryPackValue<T>(byte[], T, params string[])
Sets a MemoryPack entry value in a serialized payload at the specified path.
public static byte[] SetMemoryPackValue<T>(byte[] data, T value, params string[] path)
Parameters
databyte[]The serialized MemoryPack payload.
valueTThe value to set.
pathstring[]The path to the entry to set.
Returns
- byte[]
The modified serialized MemoryPack payload.
Type Parameters
TThe type of the value to set.
Exceptions
SetPayloadValue<T>(object, T, bool, params string[])
Sets a value in a serialized payload (JSON property or MemoryPack entry) at the specified path based on the specified options.
public static object SetPayloadValue<T>(object payload, T value, bool useMemoryPack = true, params string[] path)
Parameters
payloadobjectThe serialized payload.
valueTThe value to set.
useMemoryPackboolWhether to use MemoryPack for deserialization.
pathstring[]The path to the entry to set.
Returns
- object
The modified payload.
Type Parameters
TThe type of the value to set.