Table of Contents

Class JsonWorldSerializer

Namespace
Frent.Serialization
Assembly
Frent.dll

Provides functionality for serializing and deserializing a World instance to and from JSON.

public class JsonWorldSerializer
Inheritance
JsonWorldSerializer
Inherited Members

Constructors

JsonWorldSerializer(JsonSerializerOptions?, bool, bool)

Initializes a new instance of the JsonWorldSerializer class, which is used to serialize and deserialize World instances to and from JSON.

public JsonWorldSerializer(JsonSerializerOptions? options = null, bool ignoreNonSerializableComponents = true, bool addGeneratedTypeInfoResolvers = true)

Parameters

options JsonSerializerOptions

The JsonSerializerOptions to use for customizing JSON serialization behavior. If null, default options are used.

ignoreNonSerializableComponents bool

Indicates whether to skip components that cannot be serialized or throw an exception.

addGeneratedTypeInfoResolvers bool

Specifies whether to add source generated type resolvers to this serializer.

Properties

Default

Gets the default instance of the serializer used for serializing and deserializing world data in JSON format.

public static JsonWorldSerializer Default { get; }

Property Value

JsonWorldSerializer

Remarks

Default is used along with converters for Frent specific types.

Methods

Deserialize(Stream, bool, IUniformProvider?)

Deserializes a world and its entities from the specified JSON stream.

public World Deserialize(Stream stream, bool invokeIniters = false, IUniformProvider? uniformProvider = null)

Parameters

stream Stream
invokeIniters bool
uniformProvider IUniformProvider

Returns

World

Deserialize(string, bool, IUniformProvider?)

Deserializes a JSON string into a new instance of the World class.

public World Deserialize(string json, bool invokeIniters = false, IUniformProvider? uniformProvider = null)

Parameters

json string
invokeIniters bool
uniformProvider IUniformProvider

Returns

World

Serialize(World, Query?)

Serialize a world with optional optional filtering.

public string Serialize(World world, Query? query = null)

Parameters

world World

The world whose entities to serialize.

query Query

Optionally only serializes entities in this specific query.

Returns

string

A JSON representation of all entities in the world.

Serialize(Stream, World, Query?)

Serialize a world with optional optional filtering.

public void Serialize(Stream stream, World world, Query? query = null)

Parameters

stream Stream

The stream to write the JSON into.

world World

The world whose entities to serialize.

query Query

Optionally only serializes entities in this specific query.

Serialize(Utf8JsonWriter, World, Query?)

Serialize a world with optional optional filtering.

public void Serialize(Utf8JsonWriter writer, World world, Query? query = null)

Parameters

writer Utf8JsonWriter

The writer to write the JSON into.

world World

The world whose entities to serialize.

query Query

Optionally only serializes entities in this specific query.