How to save a dictionary as a value of another dictionary in pymongo for flask?
<p>I have a <code>Json</code> request that looks like this:</p>

<pre><code>{"name":"jane", "family": "doe",
"address":{"country":"Iran", "State": "Ilam", "city": "ilam"},
"age": "25" }
</code></pre>

<p>and i can get the values into a variable using:</p>

<pre><code>name = request.json['name']
family = requst.json['family']
age = requst.json['age']
</code></pre>

<p>but, how do i get the address field and save it to a variable?</p>

<p>If you have the following dictionary, 'address' is a dictionary that is nested in another dictionary:</p>

<pre><code>{"name":"jane", "family": "doe",
"address":{"country":"Iran", "State": "Ilam", "city": "ilam"},
"age": "25" }
</code></pre>

<p>Extracting the address is done in the following way:</p>

<pre><code>address = request.json['address']

&gt;&gt;&gt; address
{'country': 'Iran', 'State': 'Ilam', 'city': 'ilam'}
</code></pre>

<p>Address that you extracted is now a new dictionary, and you need to extract values from it like this:</p>

<pre><code>state = address['State']
city = address['city']
country = address['country']
</code></pre>

python dictionary pymongo