Sorting nested JSON array
<p>I'm attempting to sort this JSON object:</p>

<pre><code>JSONObject = {
    "command": [{
        "geobox": [...],
        "jobName": "...",
        "keywords": ["..."],
        "users": ["..."]
    }, {
        "geobox": [...],
        "jobName": "...",
        "keywords": ["...", "..."],
        "users": ["...", "...", "..."]
    }],
    "type": "..."
}
</code></pre>

<p>It has "command" which is an array of nested json objects and "type" which I don't really care about. I want it to sort the array of nested json objects in "command" in alphabetical order based on the jobName value.
I tried something like this but it didn't work.</p>

<pre><code>JSONObject.command.sort(function (a, b) {
    return JSONObject.command[a].jobName - JSONObject.command[b].jobName
});
</code></pre>
