У меня есть следующий JSON
{
"updated": [
{
"id": "1",
"email": "api.test@test.io",
"businessUnit": "US",
"firstName": "John",
"lastName": "Doe",
"age": 21,
"gender": "male"
},
{
"id": "2",
"email": "api.test@test.io",
"businessUnit": "US",
"firstName": "John",
"lastName": "Doe",
"age": 22,
"gender": "male"
},
{
"id": "3",
"email": "api.test@test.io",
"businessUnit": "US",
"firstName": "John",
"lastName": "Doe",
"age": 23,
"gender": "male"
}
],
"deleted": [
{
"id": "4",
"email": "api.test@test.io",
"businessUnit": "US",
"firstName": "John",
"lastName": "Doe",
"age": 31,
"gender": "male"
},
{
"id": "5",
"email": "api.test@test.io",
"businessUnit": "US",
"firstName": "John",
"lastName": "Doe",
"age": 32,
"gender": "male"
},
{
"id": "6",
"email": "api.test@test.io",
"businessUnit": "US",
"firstName": "John",
"lastName": "Doe",
"age": 33,
"gender": "male"
}
]
}
Возможно ли изменить поля 'id' другим способом, а не:
- set req.updated[0] .id = userId
- set req.updated [1] .id = userId
- set req.updated [2] .id = userId
Можно ли изменить все поля 'id' в обоих разделах, 'обновленные' и 'удаленные', например: