I have an object like:
obj { property1: "8898" property2: "2015-04-27 08:03:39.041" property3: "27" property4: "c10" } I need to convert this to an array.
My code:
var results=[]; for (var property in obj) { if (obj.hasOwnProperty(property)) { results.push(obj[property]) } } Here i am getting only the values. I need to have the following result ["property1":1,"property2":2] instead of [1,2]
I tried to append the property name but it did not have the desired result.