UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TJsonSerializer< Policy > Class Template Reference

#include <JsonSerializer.h>

Public Types

enum class  EFlags { None = 0 , StoreNumbersAsStrings = 1 }
 

Static Public Member Functions

template<class CharType >
static bool Deserialize (const TSharedRef< TJsonReader< CharType > > &Reader, typename Policy::FValue &OutValue, EFlags InOptions=EFlags::None)
 
template<class CharType >
static bool Deserialize (TJsonReader< CharType > &Reader, typename Policy::FValue &OutValue, EFlags InOptions=EFlags::None)
 
template<class CharType >
static bool Deserialize (const TSharedRef< TJsonReader< CharType > > &Reader, typename Policy::FArrayOfValues &OutArray, EFlags InOptions=EFlags::None)
 
template<class CharType >
static bool Deserialize (TJsonReader< CharType > &Reader, typename Policy::FArrayOfValues &OutArray, EFlags InOptions=EFlags::None)
 
template<class CharType >
static bool Deserialize (const TSharedRef< TJsonReader< CharType > > &Reader, typename Policy::FMapOfValues &OutMap, EFlags InOptions=EFlags::None)
 
template<class CharType >
static bool Deserialize (TJsonReader< CharType > &Reader, typename Policy::FMapOfValues &OutMap, EFlags InOptions=EFlags::None)
 
template<class CharType , class PrintPolicy >
static bool Serialize (const typename Policy::FValue &Value, const FString &Identifier, const TSharedRef< TJsonWriter< CharType, PrintPolicy > > &Writer, bool bCloseWriter=true)
 
template<class CharType , class PrintPolicy >
static bool Serialize (const typename Policy::FValue &Value, const FString &Identifier, TJsonWriter< CharType, PrintPolicy > &Writer, bool bCloseWriter=true)
 
template<class CharType , class PrintPolicy >
static bool Serialize (const typename Policy::FArrayOfValues &Array, const TSharedRef< TJsonWriter< CharType, PrintPolicy > > &Writer, bool bCloseWriter=true)
 
template<class CharType , class PrintPolicy >
static bool Serialize (const typename Policy::FArrayOfValues &Array, TJsonWriter< CharType, PrintPolicy > &Writer, bool bCloseWriter=true)
 
template<class CharType , class PrintPolicy >
static bool Serialize (const typename Policy::FMapOfValues &Object, const TSharedRef< TJsonWriter< CharType, PrintPolicy > > &Writer, bool bCloseWriter=true)
 
template<class CharType , class PrintPolicy >
static bool Serialize (const typename Policy::FMapOfValues &Object, TJsonWriter< CharType, PrintPolicy > &Writer, bool bCloseWriter=true)
 

Member Enumeration Documentation

◆ EFlags

template<typename Policy = FJsonSerializerPolicy_JsonObject>
enum class TJsonSerializer::EFlags
strong
Enumerator
None 
StoreNumbersAsStrings 

Member Function Documentation

◆ Deserialize() [1/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType >
static bool TJsonSerializer< Policy >::Deserialize ( const TSharedRef< TJsonReader< CharType > > &  Reader,
typename Policy::FArrayOfValues &  OutArray,
EFlags  InOptions = EFlags::None 
)
inlinestatic

◆ Deserialize() [2/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType >
static bool TJsonSerializer< Policy >::Deserialize ( const TSharedRef< TJsonReader< CharType > > &  Reader,
typename Policy::FMapOfValues &  OutMap,
EFlags  InOptions = EFlags::None 
)
inlinestatic

◆ Deserialize() [3/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType >
static bool TJsonSerializer< Policy >::Deserialize ( const TSharedRef< TJsonReader< CharType > > &  Reader,
typename Policy::FValue &  OutValue,
EFlags  InOptions = EFlags::None 
)
inlinestatic

◆ Deserialize() [4/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType >
static bool TJsonSerializer< Policy >::Deserialize ( TJsonReader< CharType > &  Reader,
typename Policy::FArrayOfValues &  OutArray,
EFlags  InOptions = EFlags::None 
)
inlinestatic

◆ Deserialize() [5/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType >
static bool TJsonSerializer< Policy >::Deserialize ( TJsonReader< CharType > &  Reader,
typename Policy::FMapOfValues &  OutMap,
EFlags  InOptions = EFlags::None 
)
inlinestatic

◆ Deserialize() [6/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType >
static bool TJsonSerializer< Policy >::Deserialize ( TJsonReader< CharType > &  Reader,
typename Policy::FValue &  OutValue,
EFlags  InOptions = EFlags::None 
)
inlinestatic

◆ Serialize() [1/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType , class PrintPolicy >
static bool TJsonSerializer< Policy >::Serialize ( const typename Policy::FArrayOfValues &  Array,
const TSharedRef< TJsonWriter< CharType, PrintPolicy > > &  Writer,
bool  bCloseWriter = true 
)
inlinestatic

Serialize the passed array of values into the writer. This will effectively serialize all of the values enclosed in [] square brackets.

Json Example:

  • Writer state: [123 <writer position> Parameter: Array: ["foo", "bar", "", 456] Serialization result: [123, ["foo", "bar", "", 456] <writer position>
Parameters
ArrayThe array we are serializing
WriterThe writer the array is written into.
bCloseWriterWhen set to true the Writer will be closed after the serialization.
Returns
Returns true if the serialization was successful, false otherwise.

◆ Serialize() [2/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType , class PrintPolicy >
static bool TJsonSerializer< Policy >::Serialize ( const typename Policy::FArrayOfValues &  Array,
TJsonWriter< CharType, PrintPolicy > &  Writer,
bool  bCloseWriter = true 
)
inlinestatic

Serialize the passed array of values into the writer. This will effectively serialize all of the values enclosed in [] square brackets.

Json Example:

  • Writer state: [123 <writer position> Parameter: Array: ["foo", "bar", "", 456] Serialization result: [123, ["foo", "bar", "", 456] <writer position>
Parameters
ArrayThe array we are serializing
WriterThe writer the array is written into.
bCloseWriterWhen set to true the Writer will be closed after the serialization.
Returns
Returns true if the serialization was successful, false otherwise.

◆ Serialize() [3/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType , class PrintPolicy >
static bool TJsonSerializer< Policy >::Serialize ( const typename Policy::FMapOfValues &  Object,
const TSharedRef< TJsonWriter< CharType, PrintPolicy > > &  Writer,
bool  bCloseWriter = true 
)
inlinestatic

Serialize the passed map of values into the writer. This will effectively serialize all of the identifier:value pairs of the map, enclosed in {} curly brackets.

Json Example:

  • Writer state: [123 <writer position> Parameter: Object: {"foo": "bar", "baz": "", "": 456} Serialization result: [123, {"foo": "bar", "baz": "", "": 456} <writer position>
Parameters
ObjectThe map of values we are serializing
WriterThe writer the object is written into.
bCloseWriterWhen set to true the Writer will be closed after the serialization.
Returns
Returns true if the serialization was successful, false otherwise.

◆ Serialize() [4/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType , class PrintPolicy >
static bool TJsonSerializer< Policy >::Serialize ( const typename Policy::FMapOfValues &  Object,
TJsonWriter< CharType, PrintPolicy > &  Writer,
bool  bCloseWriter = true 
)
inlinestatic

Serialize the passed map of values into the writer. This will effectively serialize all of the identifier:value pairs of the map, enclosed in {} curly brackets.

Json Example:

  • Writer state: [123 <writer position> Parameter: Object: {"foo": "bar", "baz": "", "": 456} Serialization result: [123, {"foo": "bar", "baz": "", "": 456} <writer position>
Parameters
ObjectThe map of values we are serializing
WriterThe writer the object is written into.
bCloseWriterWhen set to true the Writer will be closed after the serialization.
Returns
Returns true if the serialization was successful, false otherwise.

◆ Serialize() [5/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType , class PrintPolicy >
static bool TJsonSerializer< Policy >::Serialize ( const typename Policy::FValue &  Value,
const FString &  Identifier,
const TSharedRef< TJsonWriter< CharType, PrintPolicy > > &  Writer,
bool  bCloseWriter = true 
)
inlinestatic

Serialize the passed value and identifier into the writer. Empty string identifiers will be ignored when the writer is not writing inside of a map of values and only the value will be serialized. If the writer is in a state where it's currently writing inside of a map of values, then the identifier will always be serialized.

Json Examples:

  • Writer state: { "foo": "bar" <writer position> Parameters: Identifier: "" Value: "baz" Serialization result: { "foo": "bar", "": "baz" <writer position> //empty identifier is serialized as a valid key for the key:value pair "":"baz"

Writer state: { "foo": ["bar" <writer position> Parameters: Identifier: "" Value: "baz" Serialization result: { foo: ["bar", "baz" <writer position> //empty identifier is ignored since we are writing into an array and not an object.

Parameters
ValueThe value we are serializing
IdentifierThe identifier of the value, empty identifiers are ignored outside of maps of values.
WriterThe writer the value and identifier are written into.
bCloseWriterWhen set to true the Writer will be closed after the serialization.
Returns
Returns true if the serialization was successful, false otherwise.

◆ Serialize() [6/6]

template<typename Policy = FJsonSerializerPolicy_JsonObject>
template<class CharType , class PrintPolicy >
static bool TJsonSerializer< Policy >::Serialize ( const typename Policy::FValue &  Value,
const FString &  Identifier,
TJsonWriter< CharType, PrintPolicy > &  Writer,
bool  bCloseWriter = true 
)
inlinestatic

Serialize the passed value and identifier into the writer. Empty string identifiers will be ignored when the writer is not writing inside of a map of values and only the value will be serialized. If the writer is in a state where it's currently writing inside of a map of values, then the identifier will always be serialized.

Json Examples:

  • Writer state: { "foo": "bar" <writer position> Parameters: Identifier: "" Value: "baz" Serialization result: { "foo": "bar", "": "baz" <writer position> //empty identifier is serialized as a valid key for the key:value pair "":"baz"

Writer state: { "foo": ["bar" <writer position> Parameters: Identifier: "" Value: "baz" Serialization result: { foo: ["bar", "baz" <writer position> //empty identifier is ignored since we are writing into an array and not an object.

Parameters
ValueThe value we are serializing
IdentifierThe identifier of the value, empty identifiers are ignored outside of maps of values.
WriterThe writer the value and identifier are written into.
bCloseWriterWhen set to true the Writer will be closed after the serialization.
Returns
Returns true if the serialization was successful, false otherwise.

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