How to set key in a json object
<p>Following function returns wrong result. It returns <code>"key":"name", "value":"ali"</code> kind of output whereas I want to have <code>"name":"ali"</code> kind of result. If I push <code>property:json[property]</code> instead of <code>key: property, value: json[property]</code>, I get <code>"property":"ali"</code>. How can i set the value of key too?</p>

<pre><code>setProperties('{"name":"ali","age":"56"}');

function setProperties(str) {
    var properties = [];
    var json = jQuery.parseJSON(str);
    for (property in json) {
      properties.push({
        key: property,
        value: json[property]});
    }
    return properties;
}
</code></pre>
