UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FJsonStructSerializerBackend Class Reference

#include <JsonStructSerializerBackend.h>

+ Inheritance diagram for FJsonStructSerializerBackend:

Public Member Functions

 FJsonStructSerializerBackend (FArchive &InArchive)
 
 FJsonStructSerializerBackend (FArchive &InArchive, const EStructSerializerBackendFlags InFlags)
 
virtual SERIALIZATION_API void BeginArray (const FStructSerializerState &State) override
 
virtual SERIALIZATION_API void BeginStructure (const FStructSerializerState &State) override
 
virtual SERIALIZATION_API void EndArray (const FStructSerializerState &State) override
 
virtual SERIALIZATION_API void EndStructure (const FStructSerializerState &State) override
 
virtual SERIALIZATION_API void WriteComment (const FString &Comment) override
 
virtual SERIALIZATION_API void WriteProperty (const FStructSerializerState &State, int32 ArrayIndex=0) override
 
virtual SERIALIZATION_API bool WritePODArray (const FStructSerializerState &State) override
 
- Public Member Functions inherited from IStructSerializerBackend
virtual ~IStructSerializerBackend ()
 

Protected Member Functions

TSharedRef< TJsonWriter< UCS2CHAR > > & GetWriter ()
 
template<typename ValueType >
void WritePropertyValue (const FStructSerializerState &State, const ValueType &Value)
 
void WriteNull (const FStructSerializerState &State)
 

Detailed Description

Implements a writer for UStruct serialization using Json.

Note: The underlying Json serializer is currently hard-coded to use UCS2CHAR and pretty-print. This is because the current JsonWriter API does not allow writers to be substituted since it's all based on templates. At some point we will refactor the low-level Json API to provide more flexibility for serialization.

Constructor & Destructor Documentation

◆ FJsonStructSerializerBackend() [1/2]

FJsonStructSerializerBackend::FJsonStructSerializerBackend ( FArchive InArchive)
inline

Creates and initializes a new legacy instance.

Note
Deprecated, use the two-parameter constructor with EStructSerializerBackendFlags::Legacy if you need backwards compatibility with code compiled prior to 4.22.
Parameters
InArchiveThe archive to serialize into.

◆ FJsonStructSerializerBackend() [2/2]

FJsonStructSerializerBackend::FJsonStructSerializerBackend ( FArchive InArchive,
const EStructSerializerBackendFlags  InFlags 
)
inline

Creates and initializes a new instance with the given flags.

Parameters
InArchiveThe archive to serialize into.
InFlagsThe flags that control the serialization behavior (typically EStructSerializerBackendFlags::Default).

Member Function Documentation

◆ BeginArray()

void FJsonStructSerializerBackend::BeginArray ( const FStructSerializerState State)
overridevirtual

Signals the beginning of an array.

State.ValueProperty points to the property that holds the array.

Parameters
StateThe serializer's current state.
See also
BeginStructure, EndArray

Implements IStructSerializerBackend.

◆ BeginStructure()

void FJsonStructSerializerBackend::BeginStructure ( const FStructSerializerState State)
overridevirtual

Signals the beginning of a child structure.

State.ValueProperty points to the property that holds the struct.

Parameters
StateThe serializer's current state.
See also
BeginArray, EndStructure

Implements IStructSerializerBackend.

◆ EndArray()

void FJsonStructSerializerBackend::EndArray ( const FStructSerializerState State)
overridevirtual

Signals the end of an array.

State.ValueProperty points to the property that holds the array.

Parameters
StateThe serializer's current state.
See also
BeginArray, EndStructure

Implements IStructSerializerBackend.

◆ EndStructure()

void FJsonStructSerializerBackend::EndStructure ( const FStructSerializerState State)
overridevirtual

Signals the end of an object.

State.ValueProperty points to the property that holds the struct.

Parameters
StateThe serializer's current state.
See also
BeginStructure, EndArray

Implements IStructSerializerBackend.

◆ GetWriter()

TSharedRef< TJsonWriter< UCS2CHAR > > & FJsonStructSerializerBackend::GetWriter ( )
inlineprotected

◆ WriteComment()

void FJsonStructSerializerBackend::WriteComment ( const FString &  Comment)
overridevirtual

Writes a comment to the output stream.

Parameters
CommentThe comment text.
See also
BeginArray, BeginStructure, EndArray, EndStructure, WriteProperty

Implements IStructSerializerBackend.

◆ WriteNull()

void FJsonStructSerializerBackend::WriteNull ( const FStructSerializerState State)
inlineprotected

◆ WritePODArray()

bool FJsonStructSerializerBackend::WritePODArray ( const FStructSerializerState State)
overridevirtual

Writes a POD Array property to the output stream.

Note
implementations will support only a Int8 or Byte array at the moment

State.ValueProperty points to the property that holds the value to write. needs to be an ArrayProperty with a properly supported InnerProperty. State.ValueData points to the actual data to write. The array itself in this case State.TypeInfo contains the data's type information

Parameters
StateThe serializer's current state.
Returns
true if the array was properly written entirely as a pod array, false is we need to fallback to per element serialization
See also
BeginArray, BeginStructure, EndArray, EndStructure, WriteComment

Reimplemented from IStructSerializerBackend.

◆ WriteProperty()

void FJsonStructSerializerBackend::WriteProperty ( const FStructSerializerState State,
int32  ArrayIndex = 0 
)
overridevirtual

Writes a property to the output stream.

Depending on the context, properties to be written can be either object properties or array elements.

State.KeyProperty points to the key property that holds the data to write. State.KeyData points to the key property's data. State.ValueProperty points to the property that holds the value to write. State.ValueData points to the actual data to write. State.TypeInfo contains the data's type information State.ArrayIndex is the optional index if the data is a value in an array.

Parameters
StateThe serializer's current state.
See also
BeginArray, BeginStructure, EndArray, EndStructure, WriteComment

Implements IStructSerializerBackend.

Reimplemented in FNativeJSStructSerializerBackend.

◆ WritePropertyValue()

template<typename ValueType >
void FJsonStructSerializerBackend::WritePropertyValue ( const FStructSerializerState State,
const ValueType &  Value 
)
inlineprotected

The documentation for this class was generated from the following files: