title: How dynamically set value to complex json content, receiving key (or key path) and value as parameters
body: <p>As json example, I have this:</p>
  <pre><code>{
    &quot;id&quot;: &quot;foo&quot;,
    &quot;items&quot;: [
      {
        &quot;id&quot;: &quot;aaa&quot;,
        &quot;colour&quot;: &quot;blue&quot;
      },
      { 
        &quot;id&quot;: &quot;bbb&quot;,
        &quot;colour&quot;: &quot;red&quot;,
      }
    ]
  }
  </code></pre>
  <p>Once json is read in Python into a dictionary:</p>
  <p>What I want to do is a function that receives field to fill and value to be set
  For example:</p>
  <p>func(json_dict, 'items[0].colour', 'green')</p>
  <p>or</p>
  <p>func(json_dict, 'id', 'bar')</p>
  <p>And the challenge is to do this for whatever json with whatever deep I have.
  But I don't know how dynamically I can do:</p>
  <pre><code>json_dict['items'][0]['colour'] = 'green'
  json_dict['id'] = 'bar'
  </code></pre>