Hey there,
I’m currently trying to rebuild an incoming (via webhook) json that has arrays to build a new json and I’m having trouble create the new json. Hope you can help.
What I’m getting is something like that (it’s a shortned version for better understanding):
{
"$version": 7,
"$etag": "W/\"datetime'2022-04-25T13%3A13%3A48.4268362Z'\"",
"Hotel": {
"Id": "01-000",
"Label": "TESTHOTEL"
},
"Hotelchain": "TEST",
"LanguagesGeneral": "en, de",
"NumberLanguages": 2,
"Hotelcode": "TSTSTST",
"TemplateTexts": [
{
"Id": "oCHBe",
"BasicTextparts": {
"YourQuestion": "Your question",
"OurAnswer": "Your answer",
"HintHeadline": null,
"HintText": null,
"DataprotectionBox": null,
"Arrival": "Arrival",
"Departure": "Departure",
"NumberOfRooms": "Number of room(s)",
"NumberOfGuests": "Number of guest(s)",
"Adults": "Adult(s)",
"Children": "Child(ren)",
"AtTheAgeOf": "aged",
"SubjectPart1": "Your request at test hotel",
"SubjectPart2": null,
"Text": "here the bookingnr./offernr. is shown",
"SelectedLanguage": "en",
"PerRoom": "for the whole stay",
"RoomlinkText": "360° Tour through your apartment",
"PerSecondPrice": "per night per room",
"NightspluralForLengthOfStay": "nights",
"NightsingularForLengthOfStay": "night",
"Text2": "here the bookingnr./offernr. is shown",
"FinalSubjectFully1": "Your request at test hotel",
"FinalSubjectFully2": null,
"PerRoom2": "per room"
},
"Language": "en",
"ItemNumber": 1
},
{
"Id": "oCHBo",
"BasicTextparts": {
"YourQuestion": "Deine Frage",
"OurAnswer": "Unsere Anwort",
"HintHeadline": null,
"HintText": null,
"DataprotectionBox": null,
"Arrival": "Anreise",
"Departure": "Abreise",
"NumberOfRooms": "Zimmer",
"NumberOfGuests": "Gäste",
"Adults": "Erwachsene",
"Children": "Kinder",
"AtTheAgeOf": "im Alter von",
"SubjectPart1": "Deine Fragen im test hotel",
"SubjectPart2": null,
"Text": "here the bookingnr./offernr. is shown",
"SelectedLanguage": "de",
"PerRoom": "für den gesamten Aufenthalt",
"RoomlinkText": "360° Tour durchs apartment",
"PerSecondPrice": "pro Nacht pro Zimmer",
"NightspluralForLengthOfStay": "Nächte",
"NightsingularForLengthOfStay": "Nacht",
"Text2": "here the bookingnr./offernr. is shown",
"FinalSubjectFully1": "Deine Anfrage",
"FinalSubjectFully2": null,
"PerRoom2": "pro Zimmer"
},
"Language": "de",
"ItemNumber": 2
}
],
"CalcNumberLanguages": 2
}
What I want to create is something like this (also just a very short version):
"en":{
"Basic_Arrival":"Arrival",
"Basic_Departure":"Departure"
},
"de":{
"Basic_Arrival":"Anreise",
"Basic_Departure":"Abreise"
}
If it would always simply be 2 items/languages, it would be easy. But it can be any amount of languages.
I already started with ‘create a new thing’ and having 10 columns in the table with item 1, item 2, item 3 etc. In the workflow that catches the webhook, I added then 10 times the step - every time for a different item:
And then putting this parts together at the end. But it’s a huge amount of work and when I want to change 1 field in this json, I have to change all 10 steps. And if more then 10 items are selected in our UI we cannot display it at the moment.
This json is always structured the same. How can I like ‘loop’ through this json as many times as #items are there?