FJsonObjectConverter

Class that handles converting Json objects to and from UStructs

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 >& FieldValue,
    FText& TextOut
)

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

Public function Static

bool

 

GetTextFromObject

(
    const TSharedRef< FJsonObject >& Obj,
    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 >* OutStructArray,
    int64 CheckFlags,
    int64 SkipFlags
)

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

Public function Static

bool

 

JsonArrayToUStruct

(
    const TArray< TSharedPtr< FJsonValue >>& JsonArray,
    TArray< OutStructType >* OutStructArray,
    int64 CheckFlags,
    int64 SkipFlags
)

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

Public function Static

bool

 

JsonAttributesToUStruct

(
    const TMap< FString, TSharedPtr< FJsonValue > >& JsonAttributes,
    const UStruct* StructDefinition,
    void* OutStruct,
    int64 CheckFlags,
    int64 SkipFlags
)

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
)

Converts from a json string containing an object to a UStruct

Public function Static

bool

 

JsonObjectToUStruct

(
    const TSharedRef< FJsonObject >& JsonObject,
    const UStruct* StructDefinition,
    void* OutStruct,
    int64 CheckFlags,
    int64 SkipFlags
)

Converts from a Json Object to a UStruct, using importText

Public function Static

bool

 

JsonObjectToUStruct

(
    const TSharedRef< FJsonObject >& JsonObject,
    OutStructType* OutStruct,
    int64 CheckFlags,
    int64 SkipFlags
)

Templated version of JsonObjectToUStruct

Public function Static

bool

 

JsonValueToUProperty

(
    const TSharedPtr< FJsonValue >& JsonValue,
    UProperty* Property,
    void* OutValue,
    int64 CheckFlags,
    int64 SkipFlags
)

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

Public function Static

TSharedPtr< FJsonValue >

 

ObjectJsonCallback

(
    UProperty* Property,
    const void* Value
)

Utility Export Callback for having object properties expanded to full Json.

Public function Static

FFormatNamedArguments

 

ParseTextArgumentsFromJson

(
    const TSharedPtr< const FJsonObject >& JsonObject
)

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< FJsonValue >

 

UPropertyToJsonValue

(
    UProperty* Property,
    const void* Value,
    int64 CheckFlags,
    int64 SkipFlags,
    const CustomExportCallback* ExportCb
)

  • Converts from a UProperty to a Json Value using exportText

Public function Static

bool

 

UStructToFormattedJsonObjectString

(
    const UStruct* StructDefinition,
    const void* Struct,
    FString& OutJsonString,
    int64 CheckFlags,
    int64 SkipFlags,
    int32 Indent,
    const CustomExportCallback* ExportCb
)

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

Public function Static

bool

 

UStructToJsonAttributes

(
    const UStruct* StructDefinition,
    const void* Struct,
    TMap< FString, TSharedPtr< FJsonValue > >& OutJsonAttributes,
    int64 CheckFlags,
    int64 SkipFlags,
    const CustomExportCallback* ExportCb
)

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

Public function Static

TSharedPtr< FJsonObject >

 

UStructToJsonObject

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

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

Public function Static

bool

 

UStructToJsonObject

(
    const UStruct* StructDefinition,
    const void* Struct,
    TSharedRef< FJsonObject > OutJsonObject,
    int64 CheckFlags,
    int64 SkipFlags,
    const CustomExportCallback* ExportCb
)

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* ExportCb,
    bool bPrettyPrint
)

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

Public function Static

bool

 

UStructToJsonObjectString

(
    const UStruct* StructDefinition,
    const void* Struct,
    FString& OutJsonString,
    int64 CheckFlags,
    int64 SkipFlags,
    int32 Indent,
    const CustomExportCallback* ExportCb,
    bool bPrettyPrint
)

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

Typedefs

Name

Description

CustomExportCallback

Optional callback to run when exporting a type which we don't already understand.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback