For files:<p><pre><code>    import json
    with open(&quot;foo.json&quot;) as f:
        foo = json.load(f)
</code></pre>
For strings:<p><pre><code>    import json
    bar = &#x27;{&quot;foo&quot;: &quot;bar&quot;}&#x27;
    foo = json.loads(bar)</code></pre>