How to assert deeply in JSON with python
<p>I am trigerring an API call, and the server response is in JSON format.
the response looks like this:</p>

<pre><code>{
"status": 0, 
"not_passed": 1, 
"why": [
    {
        "code": 229, 
        "reason": "some reason", 
     }
]
}
</code></pre>

<p>I need to assert two thing.
Status and reason
fro status I am using:</p>

<pre><code>    r = requests.get_simple(url=Server.MY_SERVER, params=p)
data = json.loads(r.content)
assert data["status"] == 0
</code></pre>

<p>but it doesn't work for the 'reason', maybe because the 'reason' is deeper in the nested structure. How can I fix this one?</p>