can't print the value of json object in django
<p>I have this json object in ajax_data variable</p>

<pre><code>{
    "columns[0][data]": "0", 
    "columns[1][name]": "", 
    "columns[5][searchable]": "true", 
    "columns[5][name]": "", 
    "columns[4][search][regex]": "false", 
    "order[0][dir]": "asc", 
    "length": "10", 
}
</code></pre>

<p>I have converted it using json.loads() function like.</p>

<pre><code>ajax_data = json.loads(ajax_data)
</code></pre>

<p>I want to get the value if "order[0][dir]" and "columns[0][data]" but if i print it using </p>

<pre><code>ajax_data['order'][0]['dir]
</code></pre>

<p>its giving error :</p>

<pre><code>KeyError at /admin/help
'order'
</code></pre>

<p>But same code works if i access it for length key then it works.</p>

<p>That's because <code>length</code> is a key in that json object, and <code>order</code> is not.  The key names are the <em>entire</em> strings inside the quotes: <code>columns[0][data]</code>, <code>order[0][dir]</code>, etc.</p>

<p>Those are unusual key names, but perfectly valid.</p>

python django