UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Json Namespace Reference

Namespaces

namespace  Private
 

Classes

class  FJsonPointer
 
struct  FParseError
 

Typedefs

using FDocumentEncoding = rapidjson::UTF16BE< TCHAR >
 
using FEncoding = rapidjson::UTF16< TCHAR >
 
using FAllocator = Private::FAllocatorImpl
 
using FDocument = rapidjson::GenericDocument< FEncoding, FAllocator >
 
using FStringRef = FDocument::StringRefType
 
using FValue = FDocument::ValueType
 
using FMember = FValue::Member
 
using FConstObject = FValue::ConstObject
 
using FConstArray = FValue::ConstArray
 
using FObject = FValue::Object
 
using FArray = FValue::Array
 
using FStringBuffer = rapidjson::GenericStringBuffer< FEncoding, FAllocator >
 
using FStringWriter = rapidjson::Writer< FStringBuffer, FEncoding, FEncoding, FAllocator >
 
using FPrettyStringWriter = rapidjson::PrettyWriter< FStringBuffer, FEncoding, FEncoding, FAllocator >
 

Functions

JsonSimpleValueVariant ToSimpleJsonVariant (const FJsonValue &InJsonValue)
 
TSharedPtr< FJsonValueConvertRapidJsonToSharedJsonValue (const FValue &Value)
 
TSharedPtr< FJsonObjectConvertRapidJsonToSharedJsonObject (FConstObject Object)
 
TOptional< FDocumentConvertSharedJsonToRapidJsonDocument (const FJsonObject &SrcObject)
 
TOptional< boolGetBoolField (FConstObject Object, const TCHAR *FieldName)
 
TOptional< int32GetInt32Field (FConstObject Object, const TCHAR *FieldName)
 
TOptional< uint32GetUint32Field (FConstObject Object, const TCHAR *FieldName)
 
TOptional< int64GetInt64Field (FConstObject Object, const TCHAR *FieldName)
 
TOptional< uint64GetUint64Field (FConstObject Object, const TCHAR *FieldName)
 
TOptional< doubleGetDoubleField (FConstObject Object, const TCHAR *FieldName)
 
TOptional< FStringViewGetStringField (FConstObject Object, const TCHAR *FieldName)
 
bool HasField (FConstObject Object, const TCHAR *FieldName)
 
bool HasNullField (FConstObject Object, const TCHAR *FieldName)
 
TOptional< FConstObjectGetObjectField (FConstObject Object, const TCHAR *FieldName)
 
TOptional< FConstObjectGetRootObject (const FDocument &Document)
 
TOptional< FConstArrayGetArrayField (FConstObject Object, const TCHAR *FieldName)
 
int32 FindLineNumber (const FStringView JsonText, uint32 Offset)
 
TValueOrError< FDocument, FParseErrorParse (const FStringView JsonText)
 
TValueOrError< FDocument, FParseErrorParseInPlace (TArrayView< TCHAR > JsonText)
 
FString WriteCompact (const FDocument &Document)
 
FString WritePretty (const FDocument &Document)
 
const TCHARGetValueTypeName (const FValue &Value)
 
template<typename T , typename = typename std::enable_if<!std::is_same_v<T, FJsonValue>>>
JsonSimpleValueVariant ToSimpleJsonVariant (const T &InSimpleValue)
 
FStringRef MakeStringRef (FStringView Str)
 
FValue MakeStringValue (FStringView Str, FAllocator &Allocator)
 
template<typename TEnum >
TOptional< TEnumGetEnumField (FConstObject Object, const TCHAR *FieldName)
 

Variables

const constexpr uint32 DefaultParseFlags = rapidjson::ParseFlag::kParseTrailingCommasFlag
 
constexpr size_t InternalError_NotNullTerminated = 1
 

Detailed Description

Helper functions for reading/writing RapidJSON with unreal types

Typedef Documentation

◆ FAllocator

◆ FArray

using UE::Json::FArray = typedef FValue::Array

◆ FConstArray

using UE::Json::FConstArray = typedef FValue::ConstArray

◆ FConstObject

using UE::Json::FConstObject = typedef FValue::ConstObject

◆ FDocument

using UE::Json::FDocument = typedef rapidjson::GenericDocument<FEncoding, FAllocator>

◆ FDocumentEncoding

using UE::Json::FDocumentEncoding = typedef rapidjson::UTF16BE<TCHAR>

◆ FEncoding

using UE::Json::FEncoding = typedef rapidjson::UTF16<TCHAR>

◆ FMember

using UE::Json::FMember = typedef FValue::Member

◆ FObject

using UE::Json::FObject = typedef FValue::Object

◆ FPrettyStringWriter

◆ FStringBuffer

using UE::Json::FStringBuffer = typedef rapidjson::GenericStringBuffer<FEncoding, FAllocator>

◆ FStringRef

using UE::Json::FStringRef = typedef FDocument::StringRefType

◆ FStringWriter

◆ FValue

using UE::Json::FValue = typedef FDocument::ValueType

Function Documentation

◆ ConvertRapidJsonToSharedJsonObject()

JSON_API TSharedPtr< FJsonObject > UE::Json::ConvertRapidJsonToSharedJsonObject ( FConstObject  Object)

Converts from a RapidJSON object to a shared json object

◆ ConvertRapidJsonToSharedJsonValue()

JSON_API TSharedPtr< FJsonValue > UE::Json::ConvertRapidJsonToSharedJsonValue ( const FValue Value)

Converts from a RapidJSON value to a shared json value

◆ ConvertSharedJsonToRapidJsonDocument()

JSON_API TOptional< FDocument > UE::Json::ConvertSharedJsonToRapidJsonDocument ( const FJsonObject SrcObject)

Converts from shared JSON object to a RapidJSON Document.

◆ FindLineNumber()

int32 UE::Json::FindLineNumber ( const FStringView  JsonText,
uint32  Offset 
)

◆ GetArrayField()

JSON_API TOptional< FConstArray > UE::Json::GetArrayField ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to find an array with the specified name

Returns a valid array ref if the field was found and it matches an array

◆ GetBoolField()

JSON_API TOptional< bool > UE::Json::GetBoolField ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to read a boolean with a specified name.

Returns the value, if found and matches the type explicitly

◆ GetDoubleField()

JSON_API TOptional< double > UE::Json::GetDoubleField ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to read an double with a specified name.

Returns the value, if found and matches the type explicitly

◆ GetEnumField()

template<typename TEnum >
TOptional< TEnum > UE::Json::GetEnumField ( FConstObject  Object,
const TCHAR FieldName 
)
inline

Attempts to parse an enum from a string with a specified name

Returns the value, if found and matches the type explicitly

◆ GetInt32Field()

JSON_API TOptional< int32 > UE::Json::GetInt32Field ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to read an int32 with a specified name.

Returns the value, if found and matches the type explicitly

◆ GetInt64Field()

JSON_API TOptional< int64 > UE::Json::GetInt64Field ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to read an int64 with a specified name.

Returns the value, if found and matches the type explicitly

◆ GetObjectField()

JSON_API TOptional< FConstObject > UE::Json::GetObjectField ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to find an object with the specified name

Returns a valid object ref if the field was found and it matches an object.

◆ GetRootObject()

JSON_API TOptional< FConstObject > UE::Json::GetRootObject ( const FDocument Document)

Returns the root object, if that was the root type for the document

◆ GetStringField()

JSON_API TOptional< FStringView > UE::Json::GetStringField ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to read a string with a specified name

Returns the value, if found and matches the type explicitly

◆ GetUint32Field()

JSON_API TOptional< uint32 > UE::Json::GetUint32Field ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to read an uint32 with a specified name.

Returns the value, if found and matches the type explicitly

◆ GetUint64Field()

JSON_API TOptional< uint64 > UE::Json::GetUint64Field ( FConstObject  Object,
const TCHAR FieldName 
)

Attempts to read an uint64 with a specified name.

Returns the value, if found and matches the type explicitly

◆ GetValueTypeName()

JSON_API const TCHAR * UE::Json::GetValueTypeName ( const FValue Value)

Return a string representation of type name, for debug logging purposes

◆ HasField()

bool UE::Json::HasField ( FConstObject  Object,
const TCHAR FieldName 
)

◆ HasNullField()

JSON_API bool UE::Json::HasNullField ( FConstObject  Object,
const TCHAR FieldName 
)

Returns true if a field exists that is a null type

◆ MakeStringRef()

FStringRef UE::Json::MakeStringRef ( FStringView  Str)
inline

Make a RapidJSON reference to the given string.

Note
The given string must outlive the returned reference.

◆ MakeStringValue()

FValue UE::Json::MakeStringValue ( FStringView  Str,
FAllocator Allocator 
)
inline

Make a RapidJSON value that has a copy of the given string.

◆ Parse()

JSON_API TValueOrError< FDocument, FParseError > UE::Json::Parse ( const FStringView  JsonText)

Parse RapidJSON with default flags

◆ ParseInPlace()

JSON_API TValueOrError< FDocument, FParseError > UE::Json::ParseInPlace ( TArrayView< TCHAR JsonText)

Parse RapidJSON with default flags, into destructible memory, to reduce allocation counts.

JsonText must be a zero terminated string per the rapidjson documentation

◆ ToSimpleJsonVariant() [1/2]

JSON_API JsonSimpleValueVariant UE::Json::ToSimpleJsonVariant ( const FJsonValue InJsonValue)

◆ ToSimpleJsonVariant() [2/2]

template<typename T , typename = typename std::enable_if<!std::is_same_v<T, FJsonValue>>>
JsonSimpleValueVariant UE::Json::ToSimpleJsonVariant ( const T &  InSimpleValue)
inlineprotected

◆ WriteCompact()

JSON_API FString UE::Json::WriteCompact ( const FDocument Document)

Write a RapidJSON document as a compact string with default flags.

◆ WritePretty()

JSON_API FString UE::Json::WritePretty ( const FDocument Document)

Write a RapidJSON document as a pretty string with default flags and tab indentation.

Variable Documentation

◆ DefaultParseFlags

const constexpr uint32 UE::Json::DefaultParseFlags = rapidjson::ParseFlag::kParseTrailingCommasFlag
constexpr

◆ InternalError_NotNullTerminated

constexpr size_t UE::Json::InternalError_NotNullTerminated = 1
constexpr