-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map objects from two arrays by object key. #1198
Comments
This should be your expected output? My output so far from my current spec Spec |
Hello @FlorinCiocirlan I think this is what you want in output :-
spec for this :-
|
Hi There,
I'm struggling to transform this json input `
{ "RoomFacilities": [ { "RoomName": "Deluxe Double Room", "RoomFacility": "Daily housekeeping" }, { "RoomName": "Deluxe Twin Room", "RoomFacility": "Iron/ironing board" }, { "RoomName": "Deluxe Twin Room", "RoomFacility": "Heating" }, { "RoomName": "Deluxe Double Room", "RoomFacility": "Ceiling fan" } ], "Rooms": [ { "Name": "Deluxe Twin Room" }, { "Name": "Deluxe Double Room" } ] }
to this output:
"Rooms": [ { "Name": "Deluxe Twin Room", "Facilities": [{ "Name": "Iron/ironing board", "Name": "Heating", }], }, { "Name": "Deluxe Double Room", "Facilities": [{ "Name": "Ceiling fan", "Name": "Daily housekeeping", }] } ]
Basically i want to iterate over RoomsFacilities and get the corresponding Room from Rooms by Rooms.name = RoomFacilities.RoomName and then put every facility that's matching the room name under room object in facilities array.
DId anyone here have to do this before ? I mean i've tried using chat-gpt and also tried myself with no results.
The text was updated successfully, but these errors were encountered: