I would like to convert an Object "data" to an Array "expectedData". What would be the best solution to get the converted Object ?
Object I want to convert :
var data = {
"model_A": [
{
"col_1": "Article A",
"col_2": "description A",
"model_B": {
"col_3": "/imageA.jpg"
},
"model_C": [
{
"col_4": "tag1",
"col_5": 3
},
{
"col_4": "tag2",
"col_5": 4
},
]
},
{
"col_1": "Article B",
"col_2": "description B",
"model_B": {
"col_3": "/imageB.jpg"
},
}
]
}
The Array I want :
var expectedData = [
[
"Article A",
"description A",
"/imageA.jpg",
"tag1",
3
],
[
"Article A",
"description A",
"/imageA.jpg",
"tag2",
4
],
[
"Article B",
"description B",
"/imageB.jpg",
"",
""
],
]
Thank you for your answers.