 <p>Use the <code>isArray</code> method to determine if a value is an array, and you can make it one if it isn't:</p> <pre><code>var arr = data.results.thing; if (!$.isArray(arr)) { arr = [arr]; } </code></pre> <p>Now it's always an array, so you can treat it the same way all the time.</p>