Saltar al contenido
Multimedia 1 para anuncio Json to Struct and Json or Csv to datatable
0 comentarios

Descripción

Get a Json or CSV string from a file or network or anywhere, read it into a DataTable at runtime, and then convert the content into a matching structure.The values in the structure can be all data types supported by the Unreal system.

V2 version of Json and Struct conversion function has fixed these problems, but if it is converted to DataTable, still need to pay attention.

Json or CSV data needs a matching structure.(The field name must not be "Name" or a system reserved name)

Please avoid spaces in the field names, because after the project is packaged, the spaces in the field names will be modified in the Unreal system.

As a result, the fields with spaces cannot be parsed correctly after the project is packaged. This issue was raised by "CedkM" and Test it out together.

Open the Content Browser window, in the upper right corner of the Content Browser, click the Settings button, This will open a menu where you can adjust various settings for the current instance of the Content Browser, Under the View category, check the Show Plugin Content option, Find the Json to Struct and Json or Csv to datatable->Content->Json to Struct and Json or Csv to datatable directory, There are sample levels and related assets inside.

Change log : (2026/03)

5.1-5.7 version

  • XML: Json or csv to datatable to struct | V3 | xml

  • INI: Json or csv to datatable to struct | V3 | Ini

  • JSON: Json or csv to datatable to struct | V3 | Json

Supported Features: Single-value Retrieval, Array Value Retrieval, Struct Population (wildcard), Struct Array Population, Path Syntax (nesting and arrays), Type Fault Tolerance (basic types to string), Tag Renaming and Root Tag Mapping (XML)

XML Features
  • Single-value Retrieval:

    • XmlGetFieldString(XmlString, FieldPath, OutValue, bAutoTypeDetect=false)

    • Basic Type & Array Encapsulation:

      • XmlGetFieldInt, XmlGetFieldFloat, XmlGetFieldBool

      • XmlGetFieldsIntArray, XmlGetFieldsFloatArray, XmlGetFieldsBoolArray

  • Struct Retrieval:

    • XmlGetFieldStruct(XmlString, FieldPath, OutRow) (any Struct)

    • XmlGetFieldsStructArray(XmlString, FieldPath, OutRows) (any Struct array)

  • Struct & Array Conversion:

    • XmlStringToStruct, XmlStringToStructArray

    • StructToXmlString, StructArrayToXmlString

  • Tag Control:

    • XmlSetTagRenameMap(TagRenameMap): Rename tags (unified for parsing and export)

    • XmlSetRootTagMapping(StructType, RootTag): Set root tag for type (export)

  • Path Syntax:

    • Nesting: IP.Port

    • Array Index: Items[0].Id

    • Array Wildcard: Items[*].Id or Items[].Id

    • Attribute: @Attr or Node.@Attr (only at the end segment)

INI Features
  • Single-value Retrieval:

    • IniGetString(IniString, SectionName, Key, OutValue)

    • IniGetStringByPath(IniString, Path, OutValue), Path=Section.Key

    • Basic Types: IniGetInt, IniGetFloat, IniGetBool

  • Multi-value Array:

    • IniGetStringArray(IniString, SectionPrefix, Key, OutValues) (prefix matching)

    • IniGetStringArrayByPath(IniString, PathWithWildcard, OutValues) (SectionPrefix*.Key or SectionPrefix[0..N].Key)

    • Numeric Arrays: IniGetIntArray, IniGetFloatArray, IniGetBoolArray

  • Struct:

    • IniStringToStruct(IniString, SectionName, OutRow)

    • IniStringToStructArray(IniString, SectionPrefix, OutRows)

    • Export: StructToIniString(OutIniString, SectionName, Struct), StructArrayToIniString(OutIniString, SectionPrefix, StructArray)

  • Rules & Compatibility:

    • Case-insensitive key names; path whitespace trimming

    • Comma-separated values split into arrays (e.g., Tags=RPG,Action)

JSON Features
  • Single-value Retrieval:

    • JsonGetFieldString(JsonString, FieldPath, OutValue) (strings, numbers, booleans automatically converted to strings)

    • Basic Types: JsonGetFieldInt, JsonGetFieldFloat, JsonGetFieldBool

  • Multi-value Array:

    • JsonGetFieldsStringArray(JsonString, FieldPath, OutValues) (array wildcard)

    • Numeric Arrays: JsonGetFieldsIntArray, JsonGetFieldsFloatArray, JsonGetFieldsBoolArray

  • Struct:

    • JsonGetFieldStruct(JsonString, FieldPath, OutRow)

    • JsonGetFieldsStructArray(JsonString, FieldPath, OutRows)

  • Path Syntax:

    • Nesting: Player.Profile.Name

    • Array Index: Players[0].Id

    • Array Wildcard: Players[*].Id or Players[].Id

    • Case-insensitive field matching

Change log : (2021/12)

Add function "UrlEncode", Returns a percent-encoded version of the passed in string.

Add function "StructToJsonObjectStringV2";

Add function "StructArrayToJsonObjectStringV2";

Increase the function "JsonStringToStructV2";

Add function "JsonStringToStructArrayV2";

These new Json and Struct conversion functions fix several problems in the old version:

1. Now you can use the keyword "name",

2. Now it is possible that the Json and Struct fields are not completely matched, and the redundant missing and wrong fields will be ignored.

Change log : (2021/11)

Added function "CreateDataTable". Support to create an empty DataTable.

Added function "ClearDataTable". Support to clear a DataTable.

Change log : (2021/09)

Support 4.27 version

Added function "AddDataTableRow". Supports adding a row of data to the DataTable at runtime, and modifying this data if the name already exists.

Added function "RemoveDataTableRow". Support to remove a row of data for DataTable at runtime.

Added function "JsonStringToStructArray". Support converting Json data into structure array.

Added function "StructArrayToJsonObjectString". Support converting structure arrays into Json data.

Change log : (2020/12)

Support 4.26 version

Change log : (2020/07)

Support 4.22 version

Version 4.21 is supported, but it cannot be uploaded due to Unreal Market rules. Please contact me if you need it.

Add the EncodingOptions parameter of the SaveStringToFile function to select the encoding format for file storage. (Guess: It was found that the parameter was judged incorrectly in the UE code system during the test, and the UTF8 and UTF8BOM options are opposite to the actual ones)

Change log : (2020/05)

Support 4.25 version

Change log : (2020/04)

Fix bug of nested structure field name.

Added function save strings to a file. (.json | .csv | .*)

Fixed user feedback error when packaging IOS.

Support 4.23 version

Change log : (2020/03)

Can easily copy the output directly to the clipboard

Add function CopyMessageToClipboard;

Add function PasteMessageFromClipboard;

Added Parse JSON string into a struct function.

Formatos incluidos