Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Geo · Nov 20, 2020 at 02:09 AM · apisunreal

Unreal Engine Cloud Script Result Json String Parsing

How are able to get json array inside ue4 bp , Getting function get field as string returns entire json as string to me but i kinda need to parse json array which is ResultData .

Comment

People who like this

0 Show 1
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Citrus Yan · Nov 20, 2020 at 06:26 AM 0
Share

May I know how did you set up the BP? Maybe some screenshots of that?

3 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Citrus Yan · Nov 23, 2020 at 08:14 AM

I believe you should use the "Get Object Array Field" node to get the "ResultData" as a array:


bp.png (65.1 kB)
Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Geo · Nov 23, 2020 at 01:23 AM

I just already put the ss while creating the topic but yeah something went wrong i guess.



This is my title Data

{
"ResultData": [
{
"Server_ID": "0",
"Server_Name": "Asgardia",
"Server_IP": "127.0.0.1",
"Server_Port": "7777"
},
{
"Server_ID": "1",
"Server_Name": "Leonard",
"Server_IP": "127.0.0.1",
"Server_Port": "7777"
}
]
}

Comment

People who like this

0 Show 3 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Geo · Nov 20, 2020 at 12:26 PM 0
Share

https://pasteboard.co/JBeq8pK.png

https://pasteboard.co/JBeqLwh.png

avatar image Geo · Nov 20, 2020 at 12:29 PM 0
Share
CloudScript Result:

{ "FunctionResult": { "obj": { "ServerInformation": "{\"ResultData\":[{\"Server_ID\":\"0\",\"Server_Name\":\"Asgardia\",\"Server_IP\":\"127.0.0.1\",\"Server_Port\":\"7777\"},{\"Server_ID\":\"1\",\"Server_Name\":\"Leonard\",\"Server_IP\":\"127.0.0.1\",\"Server_Port\":\"7777\"}]}" } }, "Logs": [], "ExecutionTimeSeconds": 0.0303603, "MemoryConsumedBytes": 12248, "APIRequestsIssued": 1, "HttpRequestsIssued": 0, "Error": null }
avatar image Geo · Nov 20, 2020 at 12:33 PM 0
Share

CloudScript Revision Js Code


handlers.TestRequest = function (args,context) {

var data = args.titleName;

var value = server.GetTitleData({

Keys : [data]

});

// log.info(value);
// log.info(value.Data[data]);


//return {"Value" : value.Data[data]};
// return JSON.parse(JSON.stringify(value.Data[data]));
var obj = value.Data;
return {obj};
};

avatar image

Answer by Geo · Dec 15, 2020 at 01:32 AM

handlers.GetServerInformationTitleData = function (args,context) {

var data = args.titleName;

var value = server.GetTitleData({

Keys : [data]

});



return JSON.parse(value.Data[data]); /// this does the fix cuz return object was not coming as an array it was like string .

};

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Invalid Receipt Response to Validate Google Play Purchase with Unreal Blueprints 1 Answer

    UE4 Blueprint and C++ Co-Operation 1 Answer

    ​How can a client launch their game server via "Server 2.0" with custom settings? 1 Answer

    Unreal Playfab Multiplayer,Unreal Multiplayer Playfab 1 Answer

    Having trouble with Get content from CDN to Update my game's version in Unreal Engine 4 0 Answers

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges