FJsonObjectConverter

Class that handles converting Json objects to and from UStructs

Choose your operating system:

Windows

macOS

Linux

References

Module

JsonUtilities

Header

/Engine/Source/Runtime/JsonUtilities/Public/JsonObjectConverter.h

Include

#include "JsonObjectConverter.h"

Syntax

class FJsonObjectConverter

Remarks

Class that handles converting Json objects to and from UStructs

Functions

Name Description

Public function Static

bool

 

GetTextFromField

(
    const FString& FieldName,
    const TSharedPtr< FJsonValue >& Fi...,
    FText& TextOut
)

Convert a Json value to text (takes some hints from the value name)

Public function Static

bool

 

GetTextFromObject

(
    const TSharedRef< FJsonObject >& O...,
    FText& TextOut
)

Parse an FText from a json object (assumed to be of the form where keys are culture codes and values are strings)

Public function Static

bool

 

JsonArrayStringToUStruct

(
    const FString& JsonString,
    TArray< OutStructType >* OutSt...,
    int64 CheckFlags,
    int64 SkipFlags,
    const bool bStrictMode
)

Converts from a json string containing an array to an array of UStructs

Public function Static

bool

 

JsonArrayToUStruct

(
    const TArray< TSharedPtr< FJsonValu...,
    TArray< OutStructType >* OutSt...,
    int64 CheckFlags,
    int64 SkipFlags,
    const bool bStrictMode
)

Converts from an array of json values to an array of UStructs.

Public function Static

bool

 

JsonAttributesToUStruct

(
    const TMap< FString, TSharedPtr< FJ...,
    const UStruct* StructDefinitio...,
    void* OutStruct,
    int64 CheckFlags,
    int64 SkipFlags,
    const bool bStrictMode
)

Converts a set of json attributes (possibly from within a JsonObject) to a UStruct, using importText

Public function Static

bool

 

JsonObjectStringToUStruct

(
    const FString& JsonString,
    OutStructType* OutStruct,
    int64 CheckFlags,
    int64 SkipFlags,
    const bool bStrictMode
)

Converts from a json string containing an object to a UStruct

Public function Static

bool

 

JsonObjectToUStruct

(
    const TSharedRef< FJsonObject >& J...,
    const UStruct* StructDefinitio...,
    void* OutStruct,
    int64 CheckFlags,
    int64 SkipFlags,
    const bool bStrictMode
)

Converts from a Json Object to a UStruct, using importText

Public function Static

bool

 

JsonObjectToUStruct

(
    const TSharedRef< FJsonObject >& J...,
    OutStructType* OutStruct,
    int64 CheckFlags,
    int64 SkipFlags,
    const bool bStrictMode
)

Templated version of JsonObjectToUStruct

Public function Static

bool

 

JsonValueToUProperty

(
    const TSharedPtr< FJsonValue >& Js...,
    FProperty* Property,
    void* OutValue,
    int64 CheckFlags,
    int64 SkipFlags,
    const bool bStrictMode
)

Converts a single JsonValue to the corresponding FProperty (this may recurse if the property is a UStruct for instance).

Public function Static

FFormatNamed...

 

ParseTextArgumentsFromJson

(
    const TSharedPtr< const FJsonObject...
)

Parses text arguments from Json into a map

Public function Static

FString

 

StandardizeCase

(
    const FString& StringIn
)

FName case insensitivity can make the casing of UPROPERTIES unpredictable.

Public function Static

TSharedPtr< ...

 

UPropertyToJsonValue

(
    FProperty* Property,
    const void* Value,
    int64 CheckFlags,
    int64 SkipFlags,
    const CustomExportCallback* Ex...,
    FProperty* OuterProperty
)

  • Converts from a FProperty to a Json Value using exportText

Public function Static

bool

 

UStructToFormattedJsonObjectString

(
    const UStruct* StructDefinitio...,
    const void* Struct,
    FString& OutJsonString,
    int64 CheckFlags,
    int64 SkipFlags,
    int32 Indent,
    const CustomExportCallback* Ex...
)

Wrapper to UStructToJsonObjectString that allows a print policy to be specified.

Public function Static

bool

 

UStructToJsonAttributes

(
    const UStruct* StructDefinitio...,
    const void* Struct,
    TMap< FString, TSharedPtr< FJsonVal...,
    int64 CheckFlags,
    int64 SkipFlags,
    const CustomExportCallback* Ex...
)

Converts from a UStruct to a set of json attributes (possibly from within a JsonObject)

Public function Static

TSharedPtr< ...

 

UStructToJsonObject

(
    const InStructType& InStruct,
    int64 CheckFlags,
    int64 SkipFlags,
    const CustomExportCallback* Ex...
)

Templated version of UStructToJsonObject to try and make most of the params.

Public function Static

bool

 

UStructToJsonObject

(
    const UStruct* StructDefinitio...,
    const void* Struct,
    TSharedRef< FJsonObject > OutJsonOb...,
    int64 CheckFlags,
    int64 SkipFlags,
    const CustomExportCallback* Ex...
)

Converts from a UStruct to a Json Object, using exportText

Public function Static

bool

 

UStructToJsonObjectString

(
    const InStructType& InStruct,
    FString& OutJsonString,
    int64 CheckFlags,
    int64 SkipFlags,
    int32 Indent,
    const CustomExportCallback* Ex...,
    bool bPrettyPrint
)

Templated version; Converts from a UStruct to a json string containing an object, using exportText

Public function Static

bool

 

UStructToJsonObjectString

(
    const UStruct* StructDefinitio...,
    const void* Struct,
    FString& OutJsonString,
    int64 CheckFlags,
    int64 SkipFlags,
    int32 Indent,
    const CustomExportCallback* Ex...,
    bool bPrettyPrint
)

Converts from a UStruct to a json string containing an object, using exportText

Typedefs

Name

Description

CustomExportCallback

Optional callback that will be run when exporting a single property to Json.

Deprecated Functions

Name Description

Public function Static

TSharedPtr< ...

 

ObjectJsonCallback

(
    FProperty* Property,
    const void* Value
)

ObjectJsonCallback has been deprecated - please remove the usage of it from your project