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 .
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 .
May I know how did you set up the BP? Maybe some screenshots of that?
I believe you should use the "Get Object Array Field" node to get the "ResultData" as a array:
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"
}
]
}
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 }
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};
};
2 People are following this question.