Table of Contents

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

target IRecordable

The record to populate.

payload object

The serialized payload.

useMemoryPack bool

Whether 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

json string

The JSON payload.

path string[]

The path to the property to remove.

Returns

string

The modified JSON payload.

Exceptions

ArgumentException

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

data byte[]

The serialized MemoryPack payload.

path string[]

The path to the entry to remove.

Returns

byte[]

The modified serialized MemoryPack payload.

Exceptions

ArgumentException

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

payload object

The serialized payload.

useMemoryPack bool

Whether to use MemoryPack for deserialization.

path string[]

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

record IRecordable

The record to serialize.

useMemoryPack bool

Whether 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

json string

The JSON payload.

value T

The value to set.

path string[]

The path to the property to set.

Returns

string

The modified JSON payload.

Type Parameters

T

The type of the value to set.

Exceptions

ArgumentException

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

data byte[]

The serialized MemoryPack payload.

value T

The value to set.

path string[]

The path to the entry to set.

Returns

byte[]

The modified serialized MemoryPack payload.

Type Parameters

T

The type of the value to set.

Exceptions

ArgumentException

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

payload object

The serialized payload.

value T

The value to set.

useMemoryPack bool

Whether to use MemoryPack for deserialization.

path string[]

The path to the entry to set.

Returns

object

The modified payload.

Type Parameters

T

The type of the value to set.