Input JSON (e.g., from external API) { "hotelId": "H12345", "hotelName": "Sunrise Resort", "location": { "city": "Goa", "country": "India" }, "amenities": ["WiFi", "Pool", "Gym"], "rooms": [ { "roomType": "Deluxe", "price": 150, "currency": "USD" }, { "roomType": "Suite", "price": 250, "currency": "USD" } ] } Desired Output JSON { "Hotel": { "Id": "H12345", "Name": "Sunrise Resort", "City": "Goa", "Country": "India", "Amenities": [ { "Name": "WiFi" }, { "Name": "Pool" }, { "Name": "Gym" } ], "RoomList": [ { "Type": "Deluxe", "Price": 150, "Currency": "USD" }, { "Type": "Suite", "Price": 250, "Currency": "USD" } ] } } How can I transform the above input JSON into the desired nested structure using Mendix? Can this be done through a JavaScript action with custom mapping logic, or do I need to build an intermediate non-persistent entity structure and loop through the data? I'm especially unsure how to convert: The amenities array into an array of objects (with Name) The room list into a renamed and structured RoomList array
asked
Sukhvindra Singh
1 answers
1
Hi Sukhvindra,
You can click on the link below, here, I have explained a same use case scenario,