我有数组格式显示如下:-
questionValue = {
others: [{
inputValue: [{
FormTypeValueArrayValue: [
{
form_type_value: "a"
}, {
form_type_value: "b"
}, {
form_type_value: "c"
}, {
form_type_value: "d"
}
]
}]
},
{
inputValue: [{
FormTypeValueArrayValue: [
{
form_type_value: "a"
}, {
form_type_value: "b"
}, {
form_type_value: "c"
}, {
form_type_value: "d"
}
]
}]
}
]
}
但这种类型所需的格式:-
questionLevel = {
others: [{
question: "",
form_type_value: "a,b,c"
} {
question: "",
form_type_value: "d,e,f"
}],
}
我有一个不断重复的数组,所以在每个数组中我都需要简单字符串中的 form_type_value 但在受尊重的数组中
questionLevel.others = questionLevel.others.map((other)=>{
other.form_type_value = other.formTypeValuesForEachQuestion
.map( value => value.form_type_value).join(',');
delete other.formTypeValuesForEachQuestion;
return other;
});
你可以试试这个
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句