I have an element in my record json file as following:
"custitem_list": [
{
"internalid": "1",
"name": "FLAT AND DULL"
},
{
"internalid": "2",
"name": "FRIZZY"
}
]
Now I need to push the list names from the record into another json record as option values in attribute element.Following is the structure that I'm after.
"attributes": [
{
"id": 0,
"name": "Custlist",
"position": 0,
"visible": true,
"variation": false,
"options": [
{
"FLAT AND DULL",
"FRIZZY"
}
]
}
]
I have tried the following ways, but none of then is working as expected:
{
"id": 0,
"name": "Custlist",
"position": 0,
"visible": true,
"variation": false,
"options": [
{
{{#each record.custitem_list}}
{{#if @index}}
"{{{name}}}"
,{{/if}}
{{/each}}
}
]
}
{
"id": 0,
"name": "Custlist",
"position": 0,
"visible": true,
"variation": false,
"options": [
{
{{#each record.custitem_list}}
{{#if @index}},{{/if}}
{"name": "{{{name}}}"}
{{/each}}
]
}
{
"id": 0,
"name": "Custlist",
"position": 0,
"visible": true,
"variation": false,
"options": [
{
{{#each record.custitem_list }}
{{#if @index}},
{{/if}}
"{{{name}}}"
{{/each}}
}
]
}
Could anyone shed me some light?
Many many thanks