Hi i get my JSON as an object in the below way:
{
"id": "001724",
"select": false,
"class": "product",
"Names": [
"A",
"B",
"C"
],
"available": true,
"description": "selected product",
}
And i want to sort my JSON using Underscore.js in my javascript file, i'm trying to clone my main object to "names" objects adding an atrribute "name"
[{
A:[
0:{
"name":"A"
"id": "001724",
"select": false,
"class": "product",
"available": true,
"description": "selected product"
}
]
B:[
0:{
"name":"B"
"id": "001724",
"select": false,
"class": "product",
"available": true,
"description": "selected product"
}
]
C:[
0:{
"name":"C"
"id": "001724",
"select": false,
"class": "product",
"available": true,
"description": "selected product"
}
]
default:[
0:{
"name":"B"
"id": "001724",
"select": false,
"class": "product",
"available": true,
"description": "selected product"
}
]
}]
and default array contains same as 'B' array
I'm trying to to achieve this using underscore.js