Hi all,
I have a bit of a mind-twist here … I’ve spent an entire hour trying to do the following
- Get a JSON via webhook
- In that JSON there is a array with one or multiple collecitons
- I want to take that array, and write it to a .json file on an FTP.
The part I’m struggling with is to get this array directly into the .json file.
Example payload from the hook
{
"endpoint": "testendpoint",
"version": 1,
"id": "50b8d1",
"eventId": "I79D",
"room": "Feed 1",
"lastDate": "2023-02-03T00:00:00.000Z",
"titles": [{
"ContentStartDateTimeUTCQuery": "12946092",
"ContentTitle": "Some random title here",
"ContentTitleRow2": "",
"ContentID": "102",
"Name1": "",
"Name2": "",
"Name3": "",
"Name4": "",
"Name5": "",
"Name6": "",
"Name7": "",
"Name8": "",
"Name9": "",
"Name10": "",
"F1stRow1": "",
"F1stRow2": "",
"F1stRow3": "",
"F1stRow4": "",
"F1stRow5": "",
"F1stRow6": "",
"F1stRow7": "",
"F1stRow8": "",
"F1stRow9": "",
"F1stRow10": "",
"S2ndRow1": "",
"S2ndRow2": "",
"S2ndRow3": "",
"S2ndRow4": "",
"S2ndRow5": "",
"S2ndRow6": "",
"S2ndRow7": "",
"S2ndRow8": "",
"S2ndRow9": "",
"S2ndRow10": "",
"Pic1": "",
"Pic2": "",
"Pic3": "",
"Pic4": "",
"Pic5": "",
"Pic6": "",
"Pic7": "",
"Pic8": "",
"Pic9": "",
"Pic10": "",
"upnext_static": "C:\\Prod Current\\UpNext\\102.png",
"timer_red": "{0:17:59:40Z|H:mm:ssK}",
"timer_white": "{0:16:59:45Z|H:mm:ssK}",
"timer_upnext": "{0:19:29:45Z|mm:ssK}"
}, {
"ContentStartDateTimeUTCQuery": "12946122",
"ContentTitle": "Test session 2",
"ContentTitleRow2": "",
"ContentID": "106",
"Name1": "",
"Name2": "",
"Name3": "",
"Name4": "",
"Name5": "",
"Name6": "",
"Name7": "",
"Name8": "",
"Name9": "",
"Name10": "",
"F1stRow1": "",
"F1stRow2": "",
"F1stRow3": "",
"F1stRow4": "",
"F1stRow5": "",
"F1stRow6": "",
"F1stRow7": "",
"F1stRow8": "",
"F1stRow9": "",
"F1stRow10": "",
"S2ndRow1": "",
"S2ndRow2": "",
"S2ndRow3": "",
"S2ndRow4": "",
"S2ndRow5": "",
"S2ndRow6": "",
"S2ndRow7": "",
"S2ndRow8": "",
"S2ndRow9": "",
"S2ndRow10": "",
"Pic1": "",
"Pic2": "",
"Pic3": "",
"Pic4": "",
"Pic5": "",
"Pic6": "",
"Pic7": "",
"Pic8": "",
"Pic9": "",
"Pic10": "",
"upnext_static": "C:\\Prod Current\\UpNext\\106.png",
"timer_red": "{0:19:34:40Z|H:mm:ssK}",
"timer_white": "{0:19:29:45Z|H:mm:ssK}"
}]
}
What I want in my .json file on the FTP
[{
"ContentStartDateTimeUTCQuery": "12946092",
"ContentTitle": "Some random title here",
"ContentTitleRow2": "",
"ContentID": "102",
"Name1": "",
"Name2": "",
"Name3": "",
"Name4": "",
"Name5": "",
"Name6": "",
"Name7": "",
"Name8": "",
"Name9": "",
"Name10": "",
"F1stRow1": "",
"F1stRow2": "",
"F1stRow3": "",
"F1stRow4": "",
"F1stRow5": "",
"F1stRow6": "",
"F1stRow7": "",
"F1stRow8": "",
"F1stRow9": "",
"F1stRow10": "",
"S2ndRow1": "",
"S2ndRow2": "",
"S2ndRow3": "",
"S2ndRow4": "",
"S2ndRow5": "",
"S2ndRow6": "",
"S2ndRow7": "",
"S2ndRow8": "",
"S2ndRow9": "",
"S2ndRow10": "",
"Pic1": "",
"Pic2": "",
"Pic3": "",
"Pic4": "",
"Pic5": "",
"Pic6": "",
"Pic7": "",
"Pic8": "",
"Pic9": "",
"Pic10": "",
"upnext_static": "C:\\Prod Current\\UpNext\\102.png",
"timer_red": "{0:17:59:40Z|H:mm:ssK}",
"timer_white": "{0:16:59:45Z|H:mm:ssK}",
"timer_upnext": "{0:19:29:45Z|mm:ssK}"
}, {
"ContentStartDateTimeUTCQuery": "12946122",
"ContentTitle": "Test session 2",
"ContentTitleRow2": "",
"ContentID": "106",
"Name1": "",
"Name2": "",
"Name3": "",
"Name4": "",
"Name5": "",
"Name6": "",
"Name7": "",
"Name8": "",
"Name9": "",
"Name10": "",
"F1stRow1": "",
"F1stRow2": "",
"F1stRow3": "",
"F1stRow4": "",
"F1stRow5": "",
"F1stRow6": "",
"F1stRow7": "",
"F1stRow8": "",
"F1stRow9": "",
"F1stRow10": "",
"S2ndRow1": "",
"S2ndRow2": "",
"S2ndRow3": "",
"S2ndRow4": "",
"S2ndRow5": "",
"S2ndRow6": "",
"S2ndRow7": "",
"S2ndRow8": "",
"S2ndRow9": "",
"S2ndRow10": "",
"Pic1": "",
"Pic2": "",
"Pic3": "",
"Pic4": "",
"Pic5": "",
"Pic6": "",
"Pic7": "",
"Pic8": "",
"Pic9": "",
"Pic10": "",
"upnext_static": "C:\\Prod Current\\UpNext\\106.png",
"timer_red": "{0:19:34:40Z|H:mm:ssK}",
"timer_white": "{0:19:29:45Z|H:mm:ssK}"
}]
Right now, using a create JSON with set datastructure, I’m able to get something close, but it’s not right, it has the “titles”: part in front of it.
I tried a bunch of options, but couldn’t get to anything propre.
One important detail also, is that in the data I’m receiving, right now there is name 1 to 10, but it could be 1 to 100, 200 etc. So i thought of doing an iterator and map, but that wouldn’t work with a dynamic input size.
Am I missing something ?