diff --git a/PubnubLibrary.uplugin b/PubnubLibrary.uplugin index 09bd37a..c6cb9c3 100644 --- a/PubnubLibrary.uplugin +++ b/PubnubLibrary.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, - "Version": 2, - "VersionName": "0.2.2", + "Version": 3, + "VersionName": "0.2.3", "FriendlyName": "Pubnub Unreal SDK", "Description": "Quickly add interactive features to your game that scale without building your backend infrastructure.", "Category": "Code", diff --git a/Source/PubnubLibrary/Private/FunctionLibraries/PubnubJsonUtilities.cpp b/Source/PubnubLibrary/Private/FunctionLibraries/PubnubJsonUtilities.cpp index 32df4fb..237eb6e 100644 --- a/Source/PubnubLibrary/Private/FunctionLibraries/PubnubJsonUtilities.cpp +++ b/Source/PubnubLibrary/Private/FunctionLibraries/PubnubJsonUtilities.cpp @@ -23,14 +23,27 @@ bool UPubnubJsonUtilities::StringToJsonObject(FString JsonString, TSharedPtr>& OutArray) +{ + TSharedRef> JsonReader = TJsonReaderFactory::Create(JsonString); + return FJsonSerializer::Deserialize(JsonReader, OutArray); +} + bool UPubnubJsonUtilities::IsCorrectJsonString(const FString InString, bool AllowSimpleTypes) { - //A String is correct Json if it's a valid Json Object or Json Array + //A String is correct Json if it's a valid Json Object TSharedPtr JsonObject = MakeShareable(new FJsonObject); if(StringToJsonObject(InString, JsonObject)) { return true; } + + //or a Json Array + TArray> JsonArray; + if(StringToJsonArray(InString, JsonArray)) + { + return true; + } if(!AllowSimpleTypes) { diff --git a/Source/PubnubLibrary/Public/FunctionLibraries/PubnubJsonUtilities.h b/Source/PubnubLibrary/Public/FunctionLibraries/PubnubJsonUtilities.h index 0c07317..51dfe62 100644 --- a/Source/PubnubLibrary/Public/FunctionLibraries/PubnubJsonUtilities.h +++ b/Source/PubnubLibrary/Public/FunctionLibraries/PubnubJsonUtilities.h @@ -22,6 +22,9 @@ class PUBNUBLIBRARY_API UPubnubJsonUtilities : public UBlueprintFunctionLibrary //Convert FString to JsonObject. Returns true if conversion was successful static bool StringToJsonObject(FString JsonString, TSharedPtr &JsonObject); + //Convert FString to JsonArray. Returns true if conversion was successful + static bool StringToJsonArray(FString JsonString, TArray>& OutArray); + /** * Checks if gives string can be converted to a json * @param InString - String to check diff --git a/Source/ThirdParty/sdk/lib/MacOS/libpubnub.a b/Source/ThirdParty/sdk/lib/MacOS/libpubnub.a index 154284a..2dca4cf 100644 Binary files a/Source/ThirdParty/sdk/lib/MacOS/libpubnub.a and b/Source/ThirdParty/sdk/lib/MacOS/libpubnub.a differ diff --git a/Source/ThirdParty/sdk/lib/arm64/libpubnub.a b/Source/ThirdParty/sdk/lib/arm64/libpubnub.a index 40fdfc5..49faaad 100644 Binary files a/Source/ThirdParty/sdk/lib/arm64/libpubnub.a and b/Source/ThirdParty/sdk/lib/arm64/libpubnub.a differ diff --git a/Source/ThirdParty/sdk/lib/win64/pubnub.lib b/Source/ThirdParty/sdk/lib/win64/pubnub.lib index 613cd8c..ffe64e7 100644 Binary files a/Source/ThirdParty/sdk/lib/win64/pubnub.lib and b/Source/ThirdParty/sdk/lib/win64/pubnub.lib differ