I use the map method to convert from an object to an array. What is the problem in the following code?
var data = { "productName": "fsdfsdf", "productDesc": "", "category": null, "categoryName": "", "style": null, "styleName": "", "substyle": null, "substyleName": "", "store": null, "storeName": "", "stand": null, "standName": "", "rack": null, "rackName": "", "roll": null, "rollName": "", "color": null, "width": "", "widthunit": "meter", "length": 0, "lengthunit": "meter", "pieces": "", "cutofquantity": "", "estimatedConsumption": "" } var key = $.map(data, function(value, index) { return index; }); var value = $.map(data, function(value, index) { return value; }); console.log(value)
Please refer to this JSFiddle for a live example.
source share