 <p>The literal-object syntax cannot be used for non-literal keys. To use a non-literal key with an object requires the <code>object[keyExpression]</code> notation, as below. (This is equivalent to <code>object.key</code> when <code>keyExpression = "key"</code>, but note the former case takes an <em>expression</em> as the key and the latter an identifier.)</p> <pre><code>var output = [] $('.grab').each(function(index) { var obj = {} obj[$(this).attr('name')] = $(this).val() output.push(obj) }) </code></pre> <p>Happy coding.</p> <hr> <p>Also, consider using <a href="http://api.jquery.com/map/"><code>.map()</code></a>:</p> <pre><code>var output = $('.grab').map(function() { var obj = {} obj[$(this).attr('name')] = $(this).val() return obj }) </code></pre>