Skip to main content

EFMJson

JSON read/write functions with flat and nested support.

Functions

WriteJsonFile

Callable Writes a TMap as a flat JSON file.

C++

bool WriteJsonFile(const FString& FilePath, const TMap<FString, FString>& JsonData)

Category: EFM|JSON

Blueprint Node

ƒWrite Json File
File Path
Json Data
Return Value

WriteJsonFileFromString

Callable Writes a JSON string to a file.

C++

bool WriteJsonFileFromString(const FString& FilePath, const FString& JsonString)

Category: EFM|JSON

Blueprint Node

ƒWrite Json File From String
File Path
Json String
Return Value

ReadJsonFile

Pure Reads a flat JSON file into a TMap.

C++

bool ReadJsonFile(const FString& FilePath, TMap<FString, FString>& OutData)

Category: EFM|JSON

Blueprint Node

ƒRead Json File
File Path
Out Data
Return Value

ReadJsonFileAsString

Pure Reads a JSON file as a raw string.

C++

FString ReadJsonFileAsString(const FString& FilePath)

Category: EFM|JSON

Blueprint Node

ƒRead Json File As String
File Path
Return Value

MapToJsonString

Pure Converts a TMap to a JSON string.

C++

FString MapToJsonString(const TMap<FString, FString>& Data)

Category: EFM|JSON

Blueprint Node

ƒMap To Json String
Data
Return Value

JsonStringToMap

Pure Parses a JSON string into a TMap.

C++

bool JsonStringToMap(const FString& JsonString, TMap<FString, FString>& OutData)

Category: EFM|JSON

Blueprint Node

ƒJson String To Map
Json String
Out Data
Return Value

WriteJsonFileNested

Callable Writes a nested JSON string to a file.

C++

bool WriteJsonFileNested(const FString& FilePath, const FString& NestedJsonString)

Category: EFM|JSON

Blueprint Node

ƒWrite Json File Nested
File Path
Nested Json String
Return Value

ReadJsonFileNestedAsString

Pure Reads a nested JSON file as a string.

C++

FString ReadJsonFileNestedAsString(const FString& FilePath)

Category: EFM|JSON

Blueprint Node

ƒRead Json File Nested As String
File Path
Return Value

Example

// Write flat JSON
Data = Make Map
Add "PlayerName" -> "Hero"
Add "Level" -> "42"
Add "Score" -> "9999"
WriteJsonFile(GetGameSavedDirectory() + "save.json", Data)

// Read flat JSON
OutData = {}
if ReadJsonFile(GetGameSavedDirectory() + "save.json", OutData):
PlayerName = OutData["PlayerName"]

// Write nested JSON
NestedJson = '{"player":{"name":"Hero","stats":{"level":42,"score":9999}}}'
WriteJsonFileNested(GetGameSavedDirectory() + "nested.json", NestedJson)

// Read nested JSON as string
NestedContent = ReadJsonFileNestedAsString(GetGameSavedDirectory() + "nested.json")

// Convert map to string and back
JsonStr = MapToJsonString(Data)
OutData = {}
JsonStringToMap(JsonStr, OutData)