question

Carl Winder avatar image
Carl Winder asked

PlayFab Unreal -

In the XPLatCppWindows SDK, you specify the JSON for cloud scripts as:

Json::Value param;

param["blah"] = "blah_too";

and then pass that into the execute cloud script request function parameter.

In the Unreal PlayFab Plugin implementation the FunctionParameter for FExecuteCloudScriptRequest
is of type: FJsonKeeper

How do I use this FJsonKeeper object? Especially for multiple variables in the JSON.

unreal
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

You can try to refer to our testing code in the UnrealMarketplacePlugin GitHub repository. You can find the corresponding code on this page, especially on line 84.

...

outerWrapper->SetArrayField(TEXT("testReport"), TestSuiteList);

auto functionParameter = PlayFab::FJsonKeeper();
functionParameter.readFromValue(MakeShareable(new FJsonValueObject(outerWrapper)));

PlayFab::ClientModels::FExecuteCloudScriptRequest request;
request.FunctionName = TEXT("SaveTestData");
request.FunctionParameter = functionParameter;
request.GeneratePlayStreamEvent = true;
...
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Carl Winder avatar image Carl Winder commented ·

Are there any examples on how to read the JSON from a FExecuteCloudScriptResult ?

0 Likes 0 ·
Carl Winder avatar image Carl Winder Carl Winder commented ·

Nevermind, I figured it out:

	auto funcResult = result.FunctionResult.GetJsonValue()->AsObject();
	auto message = funcResult.Get();


	FString messageVal;
	 message->Values["messageValue"]->TryGetString(messageVal);
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.