9#include "Runtime/Launch/Resources/Version.h"
14UVaRestJsonObject::UVaRestJsonObject(
const FObjectInitializer& ObjectInitializer)
15 : Super(ObjectInitializer)
16 , JsonObj(MakeShared<FJsonObject>())
100 TArray<FString> Result;
101 JsonObj->Values.GetKeys(Result);
301 const TSharedPtr<FJsonValue> JsonVal =
InVal->GetRootValue();
303 switch (
InVal->GetType())
349 for (
auto Key :
Keys)
388 for (
auto&
field : Fields)
446 TArray<FString> StringArray;
456 const auto Value = (*It).Get();
457 if (Value->Type != EJson::String)
462 StringArray.Add((*It)->AsString());
476 for (
auto String : StringArray)
486 TArray<bool> BoolArray;
496 const auto Value = (*It).Get();
497 if (Value->Type != EJson::Boolean)
502 BoolArray.Add((*It)->AsBool());
536 if (Value->Type != EJson::Object)
541 TSharedPtr<FJsonObject>
NewObj = Value->AsObject();
686 FString
Str = FString(
TEXT(
"{"));
TJsonWriter< TCHAR, TCondensedJsonPrintPolicy< TCHAR > > FCondensedJsonStringWriter
TJsonWriterFactory< TCHAR, TCondensedJsonPrintPolicy< TCHAR > > FCondensedJsonStringWriterFactory
UCLASS(BlueprintType, Blueprintable)
void SetObjectField(const FString &FieldName, UVaRestJsonObject *JsonObject)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
static bool WriteStringToArchive(FArchive &Ar, const TCHAR *StrPtr, int64 Len)
UVaRestJsonValue * GetField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TArray< bool > GetBoolArrayField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
bool WriteToFile(const FString &Path) const
void RemoveField(const FString &FieldName)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TArray< T > GetTypeArrayField(const FString &FieldName) const
int32 DeserializeFromTCHARBytes(const TCHAR *Bytes, int32 Size)
TArray< float > GetNumberArrayField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TSharedRef< FJsonObject > & GetRootObject()
void SetRootObject(const TSharedPtr< FJsonObject > &JsonObject)
UVaRestJsonObject * GetObjectField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
FString EncodeJson() const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetMapFields_uint8(const TMap< FString, uint8 > &Fields)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetIntegerField(const FString &FieldName, int32 Number)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void DecodeFromArchive(TUniquePtr< FArchive > &Reader)
void SetMapFields_string(const TMap< FString, FString > &Fields)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetObjectArrayField(const FString &FieldName, const TArray< UVaRestJsonObject * > &ObjectArray)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetNumberArrayField(const FString &FieldName, const TArray< float > &NumberArray)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TArray< FString > GetStringArrayField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
int64 GetInt64Field(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void Reset()
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
FString EncodeJsonToSingleString() const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetInt64Field(const FString &FieldName, int64 Number)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
int32 DeserializeFromUTF8Bytes(const ANSICHAR *Bytes, int32 Size)
void SetStringField(const FString &FieldName, const FString &StringValue)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetMapFields_int32(const TMap< FString, int32 > &Fields)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetBoolField(const FString &FieldName, bool InValue)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void MergeJsonObject(UVaRestJsonObject *InJsonObject, bool Overwrite)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TArray< int32 > GetIntegerArrayField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
bool HasField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TArray< UVaRestJsonObject * > GetObjectArrayField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TArray< FString > GetFieldNames() const
UFUNCTION(BlueprintPure, Category = "VaRest|Json")
bool WriteToFilePath(const FString &Path, const bool bIsRelativeToProjectDir=true)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TArray< UVaRestJsonValue * > GetArrayField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetMapFields_int64(const TMap< FString, int64 > &Fields)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetField(const FString &FieldName, UVaRestJsonValue *JsonValue)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetMapFields_bool(const TMap< FString, bool > &Fields)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
int32 GetIntegerField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
float GetNumberField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetBoolArrayField(const FString &FieldName, const TArray< bool > &BoolArray)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetNumberField(const FString &FieldName, float Number)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
TSharedRef< FJsonObject > JsonObj
bool DecodeJson(const FString &JsonString, bool bUseIncrementalParser=true)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetArrayField(const FString &FieldName, const TArray< UVaRestJsonValue * > &InArray)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
bool GetBoolField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
void SetMapFields_Impl(const TMap< FString, T > &Fields)
void SetStringArrayField(const FString &FieldName, const TArray< FString > &StringArray)
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
FString GetStringField(const FString &FieldName) const
UFUNCTION(BlueprintCallable, Category = "VaRest|Json")
UCLASS(BlueprintType, Blueprintable)
void SetRootValue(TSharedPtr< FJsonValue > &JsonValue)
TSharedPtr< FJsonValue > & GetRootValue()
static uint32 CodepointFromUtf8(const ANSICHAR *&SourceString, const uint32 SourceLengthRemaining)