Hi, me again,
I have a JSON array that I'm trying to import to a Struct Array that for life of me I cannot get to load into Dashboard.
It will load other JSON arrays even though several online JSON checkers tell me the array is ok, Dashboard won't bring it into a struct array.
Using this code borrowed from one of the example panels:
//load app instance data from file
function loadappinstancejson()
{
function getappjson(resultStr)
{
if (resultStr != null)
{
var json = JSON.parse(resultStr);
ogscript.debug("json =" + resultStr)
var a = null;
if (Array.isArray(json))
{
a = json;
ogscript.debug("a =" + JSON.stringify(a))
ogscript.debug("1 =" + JSON.stringify(a[0]))
ogscript.debug("2 =" + JSON.stringify(a[1]))
ogscript.debug("3 =" + JSON.stringify(a[2]))
ogscript.debug("4 =" + JSON.stringify(a[3]))
}
else
{
a = [];
a.push(json);
var apushed = a.push(json)
ogscript.debug("apushed =" + apushed)
}
params.setAllValues('getappinstancesdata', a);
}
}
params.resetAllValues('getappinstancesdata');
ogscript.asyncPost(params.getValue('getappinstancesurl', 0), null, getappjson)
};
When I run this I can see the JSON array items in the debug window and all looks ok, it even briefly builds a Struct_Array in the parameters screen but no actual data seems to make it.
What am I doing wrong?
Here is my JSON:
[
{
"id":686114,
"account_id":13162,
"tenant_id":0,
"user_id":14807,
"is_deleted":0,
"is_deleted_depend":0,
"fid":"61e33a0a-3563-451a-81d8-63b5761c6272",
"name":"",
"firebaseUrl":"",
"thumbnail":0,
"category":0,
"apptemplate_id":57,
"apptemplate_version":160,
"created_at":"2021-04-08T12:58:15.000Z",
"updated_at":"2021-04-08T12:58:37.000Z",
"deleted_at":0,
"is_package":0,
"support_multipleDBs":0,
"token":"0R0rZkylFoT0eJJjBf7EBh",
"last_user_token":"14807",
"composition_size":2873,
"flowjob_id":0,
"onair_url":"",
"control_url":"",
"access_token":"0R0rZkylFoT0eJJjBf7EBh",
}
,{
"id":470443,
"account_id":13162,
"tenant_id":0,
"user_id":14807,
"is_deleted":0,
"is_deleted_depend":0,
"fid":"96dfa193-a521-45c6-86d9-fb9b8dc3fbea",
"name":"Glass - Sports",
"firebaseUrl":"",
"thumbnail":"",
"category":0,
"apptemplate_id":57,
"apptemplate_version":144,
"created_at":"2020-10-20T15:27:25.000Z",
"updated_at":"2021-04-08T12:57:17.000Z",
"deleted_at":0,
"is_package":0,
"support_multipleDBs":0,
"token":"69YbOa1iqNTNTA2RgdCbAV",
"last_user_token":"15641",
"composition_size":5047,
"flowjob_id":0,
"onair_url":"",
"control_url":"",
"access_token":"69YbOa1iqNTNTA2RgdCbAV",
}
,{
"id":538876,
"account_id":13162,
"tenant_id":0,
"user_id":14807,
"is_deleted":0,
"is_deleted_depend":0,
"fid":"de7b07fc-5813-4cc5-b8fe-ee3955a55e17",
"name":"Test 2 app",
"firebaseUrl":"https://fiery-torch-2122.firebaseio.com/accounts/13162/appinstances/538876",
"thumbnail":0,
"category":0,
"apptemplate_id":85,
"apptemplate_version":46,
"created_at":"2021-01-05T17:47:16.000Z",
"updated_at":"2021-04-08T12:54:58.000Z",
"deleted_at":0,
"is_package":0,
"support_multipleDBs":0,
"token":"7465UIdPEIhRF3VkkvehcA",
"last_user_token":"14807",
"composition_size":2325,
"flowjob_id":0,
"onair_url":"",
"control_url":"",
"access_token":"7465UIdPEIhRF3VkkvehcA",
}
,{
"id":539019,
"account_id":13162,
"tenant_id":0,
"user_id":15641,
"is_deleted":0,
"is_deleted_depend":0,
"fid":"817664ec-ff49-4fc8-ab9e-a91c863961c5",
"name":"CM Test app",
"firebaseUrl":"https://fiery-torch-2122.firebaseio.com/accounts/13162/appinstances/539019",
"thumbnail":0,
"category":0,
"apptemplate_id":57,
"apptemplate_version":150,
"created_at":"2021-01-05T19:53:52.000Z",
"updated_at":"2021-01-05T19:55:28.000Z",
"deleted_at":0,
"is_package":0,
"support_multipleDBs":0,
"token":"5Gzln2y1L7R7LrVIPb24pX",
"last_user_token":"15641",
"composition_size":1382,
"flowjob_id":0,
"onair_url":"",
"control_url":"",
"access_token":"5Gzln2y1L7R7LrVIPb24pX",
}
]
This is the working sample:
[{
"team":"Eagles",
"sport":"Flight",
"players": [
"Eddie",
"Sam",
"Steagle"
]
},
{
"team":"Dogs",
"sport":"Fetch",
"players": [
"Rover",
"Fido",
"Rex"
]
},
{
"team":"Cats",
"sport":"Ignoring",
"players": [
"Minou",
"Felix",
"Garfield"
]
},
{
"team":"Horses",
"sport":"Jumping",
"players": [
"Secretariat",
"Seabiscuit",
"Big Ben"
]
}
]
Chris
------------------------------
Chris Mason
ES BROADCAST LTD
------------------------------