API Reference
UWebSockLib.ToJSON
ToJSON is a polymorphic serialisation BlueprintCallable
function that takes a wildcard USTRUCT and returns an FString payload suitable for networked transport.
Usage
/**
* (BP) Serialises a USTRUCT to a JSON FString
* @param InStruct The USTRUCT we are serialising to JSON
* @return The USTRUCT's UPROPERTIES as a JSON FString
*/
UFUNCTION(BlueprintCallable, CustomThunk, Category = "WebSock")
static FString ToJSON(UProperty* InStruct)
Blueprints
Connect any USTRUCT to the ToJSON wildcard parameter
C++
If using C++ you can use the native equivalent UWebSockLib::ScriptStructToJSON
/**
* (Native) Serialises a USTRUCT to a JSON FString
* @param InStruct USTRUCT definition
* @param Data USTRUCT data
* @param MutString Mutable JSON FString to store our USTRUCT's UPROPERTIES
* @return true if the operation was successful
*/
static bool ScriptStructToJSON(UScriptStruct* InStruct, void* Data, FString& MutString);