Node.js examples for Array:Array Value
Singularize arrays (named array elements)
exports.singularizeArrays = function(miObject) { return JSON.parse(JSON.stringify(miObject, function(key, value) { if (value && (Array.isArray(value))) { var replacement = []; for (var k in value) { if (Object.hasOwnProperty.call(value, k)) { var singular = (key) ? singularize(key) : "item"; var m = {}; m[singular] = value[k]; replacement[k] = m;// ww w .j av a 2s .com } } return replacement; } return value; })); };