When I need to pass data from other people's API to the frontend, sometimes I need to change some field names. For example, Here's the data I received:
const backend = [
{
id: 1,
posts: [
{
id: 1,
title: 'hello'
}
],
},
{
id: 2,
posts: [
{
id: 3,
title: 'world'
}
]
}
]
How to change all field names id into values. Should I refer to use some recursive deep clone functions and modify the key of field accordingly?