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

#include <JsonObject.h>

Public Member Functions

template<EJson JsonType>
TSharedPtr< FJsonValueGetField (FStringView FieldName) const
 
TSharedPtr< FJsonValueGetField (FStringView FieldName, EJson JsonType) const
 
TSharedPtr< FJsonValueTryGetField (FStringView FieldName) const
 
bool HasField (FStringView FieldName) const
 
template<EJson JsonType>
bool HasTypedField (FStringView FieldName) const
 
bool HasTypedField (FStringView FieldName, EJson JsonType) const
 
JSON_API void SetField (FString &&FieldName, const TSharedPtr< FJsonValue > &Value)
 
JSON_API void SetField (const FString &FieldName, const TSharedPtr< FJsonValue > &Value)
 
JSON_API void RemoveField (FStringView FieldName)
 
JSON_API double GetNumberField (FStringView FieldName) const
 
int32 GetIntegerField (FStringView FieldName) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, float &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, double &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, int8 &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, int16 &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, int32 &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, int64 &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, uint8 &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, uint16 &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, uint32 &OutNumber) const
 
JSON_API bool TryGetNumberField (FStringView FieldName, uint64 &OutNumber) const
 
JSON_API void SetNumberField (FString &&FieldName, double Number)
 
JSON_API void SetNumberField (const FString &FieldName, double Number)
 
JSON_API FString GetStringField (FStringView FieldName) const
 
JSON_API FUtf8String GetUtf8StringField (FStringView FieldName) const
 
JSON_API bool TryGetStringField (FStringView FieldName, FString &OutString) const
 
JSON_API bool TryGetStringArrayField (FStringView FieldName, TArray< FString > &OutArray) const
 
template<typename TEnum >
bool TryGetEnumArrayField (FStringView FieldName, TArray< TEnum > &OutArray) const
 
void SetStringField (FString &&FieldName, const ANSICHAR *StringValue)
 
void SetStringField (const FString &FieldName, const ANSICHAR *StringValue)
 
void SetStringField (FString &&FieldName, const TCHAR *StringValue)
 
void SetStringField (const FString &FieldName, const TCHAR *StringValue)
 
void SetStringField (FString &&FieldName, const UTF8CHAR *StringValue)
 
void SetStringField (const FString &FieldName, const UTF8CHAR *StringValue)
 
JSON_API void SetStringField (FString &&FieldName, FString &&StringValue)
 
JSON_API void SetStringField (FString &&FieldName, const FString &StringValue)
 
JSON_API void SetStringField (const FString &FieldName, FString &&StringValue)
 
JSON_API void SetStringField (const FString &FieldName, const FString &StringValue)
 
JSON_API void SetStringField (FString &&FieldName, FUtf8String &&StringValue)
 
JSON_API void SetStringField (FString &&FieldName, const FUtf8String &StringValue)
 
JSON_API void SetStringField (const FString &FieldName, FUtf8String &&StringValue)
 
JSON_API void SetStringField (const FString &FieldName, const FUtf8String &StringValue)
 
JSON_API bool GetBoolField (FStringView FieldName) const
 
JSON_API bool TryGetBoolField (FStringView FieldName, bool &OutBool) const
 
JSON_API void SetBoolField (FString &&FieldName, bool InValue)
 
JSON_API void SetBoolField (const FString &FieldName, bool InValue)
 
JSON_API const TArray< TSharedPtr< FJsonValue > > & GetArrayField (FStringView FieldName) const
 
JSON_API bool TryGetArrayField (FStringView FieldName, const TArray< TSharedPtr< FJsonValue > > *&OutArray) const
 
JSON_API void SetArrayField (FString &&FieldName, TArray< TSharedPtr< FJsonValue > > &&Array)
 
JSON_API void SetArrayField (FString &&FieldName, const TArray< TSharedPtr< FJsonValue > > &Array)
 
JSON_API void SetArrayField (const FString &FieldName, TArray< TSharedPtr< FJsonValue > > &&Array)
 
JSON_API void SetArrayField (const FString &FieldName, const TArray< TSharedPtr< FJsonValue > > &Array)
 
JSON_API const TSharedPtr< FJsonObject > & GetObjectField (FStringView FieldName) const
 
JSON_API bool TryGetObjectField (FStringView FieldName, const TSharedPtr< FJsonObject > *&OutObject) const
 
JSON_API void SetObjectField (FString &&FieldName, const TSharedPtr< FJsonObject > &JsonObject)
 
JSON_API void SetObjectField (const FString &FieldName, const TSharedPtr< FJsonObject > &JsonObject)
 
SIZE_T GetMemoryFootprint () const
 
template<EJson JsonType>
TSharedPtr< FJsonValueGetField (FAnsiStringView FieldName) const
 
TSharedPtr< FJsonValueTryGetField (FAnsiStringView FieldName) const
 
bool HasField (FAnsiStringView FieldName) const
 
template<EJson JsonType>
bool HasTypedField (FAnsiStringView FieldName) const
 
void RemoveField (FAnsiStringView FieldName)
 
double GetNumberField (FAnsiStringView FieldName) const
 
int32 GetIntegerField (FAnsiStringView FieldName) const
 
bool TryGetNumberField (FAnsiStringView FieldName, float &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, double &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, int8 &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, int16 &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, int32 &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, int64 &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, uint8 &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, uint16 &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, uint32 &OutNumber) const
 
bool TryGetNumberField (FAnsiStringView FieldName, uint64 &OutNumber) const
 
FString GetStringField (FAnsiStringView FieldName) const
 
bool TryGetStringField (FAnsiStringView FieldName, FString &OutString) const
 
bool TryGetStringArrayField (FAnsiStringView FieldName, TArray< FString > &OutArray) const
 
template<typename TEnum >
bool TryGetEnumArrayField (FAnsiStringView FieldName, TArray< TEnum > &OutArray) const
 
bool GetBoolField (FAnsiStringView FieldName) const
 
bool TryGetBoolField (FAnsiStringView FieldName, bool &OutBool) const
 
const TArray< TSharedPtr< FJsonValue > > & GetArrayField (FAnsiStringView FieldName) const
 
bool TryGetArrayField (FAnsiStringView FieldName, const TArray< TSharedPtr< FJsonValue > > *&OutArray) const
 
const TSharedPtr< FJsonObject > & GetObjectField (FAnsiStringView FieldName) const
 
bool TryGetObjectField (FAnsiStringView FieldName, const TSharedPtr< FJsonObject > *&OutObject) const
 

Static Public Member Functions

static JSON_API void Duplicate (const TSharedPtr< const FJsonObject > &Source, const TSharedPtr< FJsonObject > &Dest)
 
static JSON_API void Duplicate (const TSharedPtr< FJsonObject > &Source, TSharedPtr< FJsonObject > &Dest)
 

Public Attributes

TMap< FString, TSharedPtr< FJsonValue > > Values
 

Detailed Description

A Json Object is a structure holding an unordered set of name/value pairs. In a Json file, it is represented by everything between curly braces {}.

Member Function Documentation

◆ Duplicate() [1/2]

void FJsonObject::Duplicate ( const TSharedPtr< const FJsonObject > &  Source,
const TSharedPtr< FJsonObject > &  Dest 
)
static

◆ Duplicate() [2/2]

void FJsonObject::Duplicate ( const TSharedPtr< FJsonObject > &  Source,
TSharedPtr< FJsonObject > &  Dest 
)
static

◆ GetArrayField() [1/2]

const TArray< TSharedPtr< FJsonValue > > & FJsonObject::GetArrayField ( FAnsiStringView  FieldName) const
inline

◆ GetArrayField() [2/2]

const TArray< TSharedPtr< FJsonValue > > & FJsonObject::GetArrayField ( FStringView  FieldName) const

Get the field named FieldName as an array.

◆ GetBoolField() [1/2]

bool FJsonObject::GetBoolField ( FAnsiStringView  FieldName) const
inline

◆ GetBoolField() [2/2]

bool FJsonObject::GetBoolField ( FStringView  FieldName) const

Gets the field with the specified name as a boolean.

Ensures that the field is present and is of type Json number.

Parameters
FieldNameThe name of the field to get.
Returns
The field's value as a boolean.

◆ GetField() [1/3]

template<EJson JsonType>
TSharedPtr< FJsonValue > FJsonObject::GetField ( FAnsiStringView  FieldName) const
inline

◆ GetField() [2/3]

template<EJson JsonType>
TSharedPtr< FJsonValue > FJsonObject::GetField ( FStringView  FieldName) const
inline

◆ GetField() [3/3]

TSharedPtr< FJsonValue > FJsonObject::GetField ( FStringView  FieldName,
EJson  JsonType 
) const
inline

◆ GetIntegerField() [1/2]

int32 FJsonObject::GetIntegerField ( FAnsiStringView  FieldName) const
inline

◆ GetIntegerField() [2/2]

int32 FJsonObject::GetIntegerField ( FStringView  FieldName) const
inline

Gets a numeric field and casts to an int32

◆ GetMemoryFootprint()

SIZE_T FJsonObject::GetMemoryFootprint ( ) const
inline

Returns the memory footprint for this object in Bytes, including sizeof(*this) and allocated memory.

◆ GetNumberField() [1/2]

double FJsonObject::GetNumberField ( FAnsiStringView  FieldName) const
inline

◆ GetNumberField() [2/2]

double FJsonObject::GetNumberField ( FStringView  FieldName) const

Gets the field with the specified name as a number.

Ensures that the field is present and is of type Json number.

Parameters
FieldNameThe name of the field to get.
Returns
The field's value as a number.

◆ GetObjectField() [1/2]

const TSharedPtr< FJsonObject > & FJsonObject::GetObjectField ( FAnsiStringView  FieldName) const
inline

◆ GetObjectField() [2/2]

const TSharedPtr< FJsonObject > & FJsonObject::GetObjectField ( FStringView  FieldName) const

Gets the field with the specified name as a Json object.

Ensures that the field is present and is of type Json object.

Parameters
FieldNameThe name of the field to get.
Returns
The field's value as a Json object.

◆ GetStringField() [1/2]

FString FJsonObject::GetStringField ( FAnsiStringView  FieldName) const
inline

◆ GetStringField() [2/2]

FString FJsonObject::GetStringField ( FStringView  FieldName) const

Get the field named FieldName as a string.

◆ GetUtf8StringField()

FUtf8String FJsonObject::GetUtf8StringField ( FStringView  FieldName) const

Get the field named FieldName as a UTF8 string.

◆ HasField() [1/2]

bool FJsonObject::HasField ( FAnsiStringView  FieldName) const
inline

◆ HasField() [2/2]

bool FJsonObject::HasField ( FStringView  FieldName) const
inline

Checks whether a field with the specified name exists in the object.

Parameters
FieldNameThe name of the field to check.
Returns
true if the field exists, false otherwise.

◆ HasTypedField() [1/3]

template<EJson JsonType>
bool FJsonObject::HasTypedField ( FAnsiStringView  FieldName) const
inline

◆ HasTypedField() [2/3]

template<EJson JsonType>
bool FJsonObject::HasTypedField ( FStringView  FieldName) const
inline

Checks whether a field with the specified name and type exists in the object.

Template Parameters
JsonTypeThe type of the field to check.
Parameters
FieldNameThe name of the field to check.
Returns
true if the field exists, false otherwise.

◆ HasTypedField() [3/3]

bool FJsonObject::HasTypedField ( FStringView  FieldName,
EJson  JsonType 
) const
inline

Checks whether a field with the specified name and type exists in the object.

Parameters
JsonTypeThe type of the field to check.
FieldNameThe name of the field to check.
Returns
true if the field exists, false otherwise.

◆ RemoveField() [1/2]

void FJsonObject::RemoveField ( FAnsiStringView  FieldName)
inline

◆ RemoveField() [2/2]

void FJsonObject::RemoveField ( FStringView  FieldName)

Removes the field with the specified name.

Parameters
FieldNameThe name of the field to remove.

◆ SetArrayField() [1/4]

void FJsonObject::SetArrayField ( const FString &  FieldName,
const TArray< TSharedPtr< FJsonValue > > &  Array 
)

◆ SetArrayField() [2/4]

void FJsonObject::SetArrayField ( const FString &  FieldName,
TArray< TSharedPtr< FJsonValue > > &&  Array 
)

◆ SetArrayField() [3/4]

void FJsonObject::SetArrayField ( FString &&  FieldName,
const TArray< TSharedPtr< FJsonValue > > &  Array 
)

◆ SetArrayField() [4/4]

void FJsonObject::SetArrayField ( FString &&  FieldName,
TArray< TSharedPtr< FJsonValue > > &&  Array 
)

Set an array field named FieldName and value of Array

◆ SetBoolField() [1/2]

void FJsonObject::SetBoolField ( const FString &  FieldName,
bool  InValue 
)

◆ SetBoolField() [2/2]

void FJsonObject::SetBoolField ( FString &&  FieldName,
bool  InValue 
)

Set a boolean field named FieldName and value of InValue

◆ SetField() [1/2]

void FJsonObject::SetField ( const FString &  FieldName,
const TSharedPtr< FJsonValue > &  Value 
)

◆ SetField() [2/2]

void FJsonObject::SetField ( FString &&  FieldName,
const TSharedPtr< FJsonValue > &  Value 
)

Sets the value of the field with the specified name.

Parameters
FieldNameThe name of the field to set.
ValueThe value to set.

◆ SetNumberField() [1/2]

void FJsonObject::SetNumberField ( const FString &  FieldName,
double  Number 
)

◆ SetNumberField() [2/2]

void FJsonObject::SetNumberField ( FString &&  FieldName,
double  Number 
)

Add a field named FieldName with Number as value

◆ SetObjectField() [1/2]

void FJsonObject::SetObjectField ( const FString &  FieldName,
const TSharedPtr< FJsonObject > &  JsonObject 
)

◆ SetObjectField() [2/2]

void FJsonObject::SetObjectField ( FString &&  FieldName,
const TSharedPtr< FJsonObject > &  JsonObject 
)

Set an ObjectField named FieldName and value of JsonObject

◆ SetStringField() [1/14]

void FJsonObject::SetStringField ( const FString &  FieldName,
const ANSICHAR StringValue 
)
inline

◆ SetStringField() [2/14]

void FJsonObject::SetStringField ( const FString &  FieldName,
const FString &  StringValue 
)

◆ SetStringField() [3/14]

void FJsonObject::SetStringField ( const FString &  FieldName,
const FUtf8String StringValue 
)

◆ SetStringField() [4/14]

void FJsonObject::SetStringField ( const FString &  FieldName,
const TCHAR StringValue 
)
inline

◆ SetStringField() [5/14]

void FJsonObject::SetStringField ( const FString &  FieldName,
const UTF8CHAR StringValue 
)
inline

◆ SetStringField() [6/14]

void FJsonObject::SetStringField ( const FString &  FieldName,
FString &&  StringValue 
)

◆ SetStringField() [7/14]

void FJsonObject::SetStringField ( const FString &  FieldName,
FUtf8String &&  StringValue 
)

◆ SetStringField() [8/14]

void FJsonObject::SetStringField ( FString &&  FieldName,
const ANSICHAR StringValue 
)
inline

Add a field named FieldName with value of StringValue

◆ SetStringField() [9/14]

void FJsonObject::SetStringField ( FString &&  FieldName,
const FString &  StringValue 
)

◆ SetStringField() [10/14]

void FJsonObject::SetStringField ( FString &&  FieldName,
const FUtf8String StringValue 
)

◆ SetStringField() [11/14]

void FJsonObject::SetStringField ( FString &&  FieldName,
const TCHAR StringValue 
)
inline

◆ SetStringField() [12/14]

void FJsonObject::SetStringField ( FString &&  FieldName,
const UTF8CHAR StringValue 
)
inline

◆ SetStringField() [13/14]

void FJsonObject::SetStringField ( FString &&  FieldName,
FString &&  StringValue 
)

◆ SetStringField() [14/14]

void FJsonObject::SetStringField ( FString &&  FieldName,
FUtf8String &&  StringValue 
)

◆ TryGetArrayField() [1/2]

bool FJsonObject::TryGetArrayField ( FAnsiStringView  FieldName,
const TArray< TSharedPtr< FJsonValue > > *&  OutArray 
) const
inline

◆ TryGetArrayField() [2/2]

bool FJsonObject::TryGetArrayField ( FStringView  FieldName,
const TArray< TSharedPtr< FJsonValue > > *&  OutArray 
) const

Try to get the field named FieldName as an array, or return false if it's another type

◆ TryGetBoolField() [1/2]

bool FJsonObject::TryGetBoolField ( FAnsiStringView  FieldName,
bool OutBool 
) const
inline

◆ TryGetBoolField() [2/2]

bool FJsonObject::TryGetBoolField ( FStringView  FieldName,
bool OutBool 
) const

Get the field named FieldName as a string. Returns false if it doesn't exist or cannot be converted.

◆ TryGetEnumArrayField() [1/2]

template<typename TEnum >
bool FJsonObject::TryGetEnumArrayField ( FAnsiStringView  FieldName,
TArray< TEnum > &  OutArray 
) const
inline

◆ TryGetEnumArrayField() [2/2]

template<typename TEnum >
bool FJsonObject::TryGetEnumArrayField ( FStringView  FieldName,
TArray< TEnum > &  OutArray 
) const
inline

Get the field named FieldName as an array of enums. Returns false if it doesn't exist or any member is not a string.

◆ TryGetField() [1/2]

TSharedPtr< FJsonValue > FJsonObject::TryGetField ( FAnsiStringView  FieldName) const
inline

◆ TryGetField() [2/2]

TSharedPtr< FJsonValue > FJsonObject::TryGetField ( FStringView  FieldName) const
inline

Attempts to get the field with the specified name.

Parameters
FieldNameThe name of the field to get.
Returns
A pointer to the field, or nullptr if the field doesn't exist.

◆ TryGetNumberField() [1/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
double OutNumber 
) const
inline

◆ TryGetNumberField() [2/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
float OutNumber 
) const
inline

◆ TryGetNumberField() [3/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
int16 OutNumber 
) const
inline

◆ TryGetNumberField() [4/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
int32 OutNumber 
) const
inline

◆ TryGetNumberField() [5/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
int64 OutNumber 
) const
inline

◆ TryGetNumberField() [6/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
int8 OutNumber 
) const
inline

◆ TryGetNumberField() [7/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
uint16 OutNumber 
) const
inline

◆ TryGetNumberField() [8/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
uint32 OutNumber 
) const
inline

◆ TryGetNumberField() [9/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
uint64 OutNumber 
) const
inline

◆ TryGetNumberField() [10/20]

bool FJsonObject::TryGetNumberField ( FAnsiStringView  FieldName,
uint8 OutNumber 
) const
inline

◆ TryGetNumberField() [11/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
double OutNumber 
) const

Get the field named FieldName as a number. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [12/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
float OutNumber 
) const

Get the field named FieldName as a number. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [13/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
int16 OutNumber 
) const

Get the field named FieldName as a number, and makes sure it's within int16 range. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [14/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
int32 OutNumber 
) const

Get the field named FieldName as a number, and makes sure it's within int32 range. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [15/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
int64 OutNumber 
) const

Get the field named FieldName as a number. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [16/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
int8 OutNumber 
) const

Get the field named FieldName as a number, and makes sure it's within int8 range. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [17/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
uint16 OutNumber 
) const

Get the field named FieldName as a number, and makes sure it's within uint16 range. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [18/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
uint32 OutNumber 
) const

Get the field named FieldName as a number, and makes sure it's within uint32 range. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [19/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
uint64 OutNumber 
) const

Get the field named FieldName as a number, and makes sure it's within uint64 range. Returns false if it doesn't exist or cannot be converted.

◆ TryGetNumberField() [20/20]

bool FJsonObject::TryGetNumberField ( FStringView  FieldName,
uint8 OutNumber 
) const

Get the field named FieldName as a number, and makes sure it's within uint8 range. Returns false if it doesn't exist or cannot be converted.

◆ TryGetObjectField() [1/2]

bool FJsonObject::TryGetObjectField ( FAnsiStringView  FieldName,
const TSharedPtr< FJsonObject > *&  OutObject 
) const
inline

◆ TryGetObjectField() [2/2]

bool FJsonObject::TryGetObjectField ( FStringView  FieldName,
const TSharedPtr< FJsonObject > *&  OutObject 
) const

Try to get the field named FieldName as an object, or return false if it's another type

◆ TryGetStringArrayField() [1/2]

bool FJsonObject::TryGetStringArrayField ( FAnsiStringView  FieldName,
TArray< FString > &  OutArray 
) const
inline

◆ TryGetStringArrayField() [2/2]

bool FJsonObject::TryGetStringArrayField ( FStringView  FieldName,
TArray< FString > &  OutArray 
) const

Get the field named FieldName as an array of strings. Returns false if it doesn't exist or any member cannot be converted.

◆ TryGetStringField() [1/2]

bool FJsonObject::TryGetStringField ( FAnsiStringView  FieldName,
FString &  OutString 
) const
inline

◆ TryGetStringField() [2/2]

bool FJsonObject::TryGetStringField ( FStringView  FieldName,
FString &  OutString 
) const

Get the field named FieldName as a string. Returns false if it doesn't exist or cannot be converted.

Member Data Documentation

◆ Values

TMap<FString, TSharedPtr<FJsonValue> > FJsonObject::Values

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