i have response data like this
{
"data": {
"title": "dashboard",
"description": "just test dashboard",
"photos": [
{
"file_name": "12345454.jpg",
"photo_name": "indonesia"
},
{
"file_name": "567686.jpg",
"photo_name": "jakarta"
}]
}
}
then i need change response of data with file_name of array without photos variable.
expected: file_name[0] will be sign from file_name index of array
like this
{
"data": {
"title": "dashboard",
"description": "just test dashboard",
"file_name[0]": "12345454.jpg",
"file_name[1]": "567686.jpg"
}
}
i have try with map of photos but didn't work
this.data = this.data.photos.map((item, idx) => {
let data = {
file_name: item.file_name
}
return data
})
this.data.photos.map((item, idx) => {
this.$set(this.data, 'file_name', item.file_name)
})