It is necessary that the dictionary of the form
# input
items_dict = {
123: [1, 2, 3],
456: [1, 2, 3, 4],
678: [1, 2]
}
was converted to the following array
# output
[
{'item_ids': [123, 456], 'users_ids': [3]},
{'item_ids': [456], 'users_ids': [4]},
{'item_ids': [123, 456, 678], 'users_ids': [1, 2]}
]
The logic is as follows, I have an item_dict dictionary, the item_id key is the id of the house, the value of users_ids is the id of the users to send the letter to, I want to convert this into an array of dictionaries, item_ids is an array of houses, users_ids is an array of users, I want to do this in order to send the same letter to several users at once, and not individually, to reduce the number of requests.