underscorejs - how remove array?
i have array of objects. remove array. please refer code below more details,
array = [{a:10,b:20},{c:10,b:20},{a:10,d:20}];
expected output: {a:10,b:20},{c:10,b:20},{a:10,d:20}
as understand need output without []. manage first stringify array, next cut first , last letter.
var array = [{a:10,b:20},{c:10,b:20},{a:10,d:20}]; var str=json.stringify(array); console.log(str.substring(1,str.length-1));
final string has no [] signs not valid json structure. in json must 1 root element [] or {}.
Comments
Post a Comment