[
{
"thumbsup": [
{
"feedback": "thumbsup",
"feedbackMessage": "It was easy to make a payment",
"feedbackAllFlows": [
"map"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Fast and simple.",
"feedbackAllFlows": [
"map"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very fast",
"feedbackAllFlows": [
"sales",
"cases"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very easy to use.",
"feedbackAllFlows": [
"off shore"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Great help. Once I asked tge correct question",
"feedbackAllFlows": [
"off shore",
"disconnect",
"thanks"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very quick",
"feedbackAllFlows": [
"pay later"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "improve the billing and help better understanding the bill cycle",
"feedbackAllFlows": [
"pay later",
"high"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Everything was simple and easy. Quick responses made the process a lot faster.",
"feedbackAllFlows": [
"activate"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very helpful",
"feedbackAllFlows": [
"pay later"
]
}
]
}
]
< /code>
Я хочу разбить это на свои собственные массивы для комментариев из массива обратной связи ... < /p>
Я бы хотел, чтобы выход был похож на это ... < /p>
[
{
"thumbsup": [
{
"map": [
"It was easy to make a payment",
"Fast and simple."
]
},
{
"sale": [
"Very fast"
]
},
{
"cases": [
"Very fast"
]
},
{
"off shore": [
"Very easy to use.",
"Great help. Once I asked tge correct question"
]
},
{
"disconnect": [
"Great help. Once I asked tge correct question"
]
},
{
"thanks": [
"Great help. Once I asked tge correct question"
]
},
{
"pay later": [
"Very quick",
"improve the billing and help better understanding the bill cycle",
"Very helpful"
]
},
{
"high": [
"improve the billing and help better understanding the bill cycle"
]
},
{
"equipment_activate_device": [
"Everything was simple and easy. Quick responses made the process a lot faster."
]
}
]
}
]
< /code>
Я попробовал следующее, но он не объединяет имена потоков должным образом ... < /p>
var mainArr = [];
tup[0].thumbsup.map(obj => {
//console.log(obj.feedbackAllFlows)
obj.feedbackAllFlows.map ((flow) => {
mainArr.push({flow: obj.feedbackMessage})
})
})
console.log(mainArr)
< /code>
Я ожидал, что «поток» будет именем потока, но это не правильно, он использует поток в качестве значения ключа, а не фактический поток. < /p>
Вот мой полный код: < /p>
ar mainArr = [];
tup[0].thumbsup.map(obj => {
//console.log(obj.feedbackAllFlows)
obj.feedbackAllFlows.map ((flow) => {
mainArr.push({flow: obj.feedbackMessage})
})
})
console.log(mainArr)< /code>
let tup = [
{
"thumbsup": [
{
"feedback": "thumbsup",
"feedbackMessage": "It was easy to make a payment",
"feedbackAllFlows": [
"map"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Fast and simple.",
"feedbackAllFlows": [
"map"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very fast",
"feedbackAllFlows": [
"sales",
"cases"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very easy to use.",
"feedbackAllFlows": [
"off shore"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Great help. Once I asked tge correct question",
"feedbackAllFlows": [
"offshore",
"disconnect",
"thanks"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very quick",
"feedbackAllFlows": [
"pay later"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "improve the billing and help better understanding the bill cycle",
"feedbackAllFlows": [
"pay later",
"high"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Everything was simple and easy. Quick responses made the process a lot faster.",
"feedbackAllFlows": [
"activate"
]
},
{
"feedback": "thumbsup",
"feedbackMessage": "Very helpful",
"feedbackAllFlows": [
"pay later"
]
}
]
}
];
У меня есть пример тестового примера, с которым я работаю ... < /p> [code][ { "thumbsup": [ { "feedback": "thumbsup", "feedbackMessage": "It was easy to make a payment", "feedbackAllFlows": [ "map" ] }, { "feedback": "thumbsup", "feedbackMessage": "Fast and simple.", "feedbackAllFlows": [ "map" ] }, { "feedback": "thumbsup", "feedbackMessage": "Very fast", "feedbackAllFlows": [ "sales", "cases" ] }, { "feedback": "thumbsup", "feedbackMessage": "Very easy to use.", "feedbackAllFlows": [ "off shore" ] }, { "feedback": "thumbsup", "feedbackMessage": "Great help. Once I asked tge correct question", "feedbackAllFlows": [ "off shore", "disconnect", "thanks" ] }, { "feedback": "thumbsup", "feedbackMessage": "Very quick", "feedbackAllFlows": [ "pay later" ] }, { "feedback": "thumbsup", "feedbackMessage": "improve the billing and help better understanding the bill cycle", "feedbackAllFlows": [ "pay later", "high" ] }, { "feedback": "thumbsup", "feedbackMessage": "Everything was simple and easy. Quick responses made the process a lot faster.", "feedbackAllFlows": [ "activate" ] }, { "feedback": "thumbsup", "feedbackMessage": "Very helpful", "feedbackAllFlows": [ "pay later" ] } ] } ] < /code> Я хочу разбить это на свои собственные массивы для комментариев из массива обратной связи ... < /p> Я бы хотел, чтобы выход был похож на это ... < /p> [ { "thumbsup": [ { "map": [ "It was easy to make a payment", "Fast and simple." ] }, { "sale": [ "Very fast" ] }, { "cases": [ "Very fast" ] }, { "off shore": [ "Very easy to use.", "Great help. Once I asked tge correct question" ] }, { "disconnect": [ "Great help. Once I asked tge correct question" ] }, { "thanks": [ "Great help. Once I asked tge correct question" ] }, { "pay later": [ "Very quick", "improve the billing and help better understanding the bill cycle", "Very helpful" ] }, { "high": [ "improve the billing and help better understanding the bill cycle" ] }, { "equipment_activate_device": [ "Everything was simple and easy. Quick responses made the process a lot faster." ] } ] } ] < /code> Я попробовал следующее, но он не объединяет имена потоков должным образом ... < /p> var mainArr = [];
console.log(mainArr) < /code> Я ожидал, что «поток» будет именем потока, но это не правильно, он использует поток в качестве значения ключа, а не фактический поток. < /p> Вот мой полный код: < /p>