RealDocs

UDataTableFunctionLibrary::FillDataTableFromJSONFile

function Engine Blueprint Since unknown
#include "Kismet/DataTableFunctionLibrary.h"
Access: public Specifiers: staticBlueprintCallable

Description

Empties the given Data Table and repopulates it by importing the JSON file at the given path. Editor-only — used for scripted asset pipelines and automated data import.

Caveats & Gotchas

  • Only compiles with WITH_EDITOR — calling this from packaged game code is not possible; it exists for editor scripting and commandlets.
  • The table is emptied before import, so a malformed JSON file leaves the table blank rather than reverting to its previous contents.
  • If ImportRowStruct is left null and the table has no row struct assigned, the import will prompt interactively when run inside the editor UI; pass ImportRowStruct explicitly to keep automated pipelines (e.g. commandlets) non-interactive.

Signature

static bool FillDataTableFromJSONFile(UDataTable* DataTable, const FString& JSONFilePath, UScriptStruct* ImportRowStruct = nullptr);

Parameters

Name Type Description Default
DataTable UDataTable* The table to empty and repopulate.
JSONFilePath const FString& File-system path of the JSON file to read.
ImportRowStruct UScriptStruct* Optional row struct to force for the import; also makes the import fully automated with no dialogs. nullptr

Return Type

bool

Example

Reimport a table from JSON in an editor script C++
bool bOk = UDataTableFunctionLibrary::FillDataTableFromJSONFile(MyDataTable, TEXT("C:/Data/Items.json"), FMyItemRow::StaticStruct());
if (!bOk)
{
    UE_LOG(LogTemp, Error, TEXT("Failed to import Items.json into MyDataTable"));
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.