01-08-2020 09:06 PM
Hello Experts,
Input :-
{
“column”: [
{
“name”: “firstName”
},
{
“name”: “lastName”
},
{
“name”: “middleName”
}
],
“content”: [
[
“aa”,
“bb”,
“cc”
],
[
“dd”,
“ee”,
“ff”
],
[
“oo”,
“pp”,
“qq”
]
]
}
Output :-
{
“data”: [
{
“firstName”: “aa”,
“lastName”: “bb”,
“middlename”: “cc”
},
{
“firstName”: “dd”,
“lastName”: “ee”,
“middlename”: “ff”
},
{
“firstName”: “oo”,
“lastName”: “pp”,
“middlename”: “qq”
}
]
}
can someone help me to achieve this without using scrip snap.
01-09-2020 10:05 AM
Hi @Ajay_Chawda
Using a json Generator with your input document and a downstream mapper with this expression:
$content.map(row => row.toObject((elem, index) => $column[index].name))
Mapped to a target path: $data
produces your desired output.
01-09-2020 02:54 PM
@cjhoward18 thank you for help it worked like magic.