title: add main attribute to json object in python
body: <p>I want to add main attribute to json objects. Please see the python code, json objects and expected outcomes below.</p>
  <p><strong>data.json</strong></p>
  <pre><code>    [{
         &quot;Full Address&quot;: &quot;data1&quot;,
         &quot;p1&quot;: &quot;1&quot;,
         &quot;p2&quot;: &quot;6&quot;  
        },
        {
        &quot;Full Address&quot;: &quot;data2&quot;,
        &quot;p1&quot;: &quot;1&quot;,
        &quot;p2&quot;: &quot;6&quot;
      }]
  </code></pre>
  <p><strong>expected outcomes</strong></p>
  <pre><code>    [{
      &quot;fields&quot;: {
        &quot;Full Address&quot;: &quot;data1&quot;,
        &quot;p1&quot;: &quot;1&quot;,
        &quot;p2&quot;: &quot;6&quot;
         }
       },
       {
     &quot;fields&quot;: {
      &quot;Full Address&quot;: &quot;data2&quot;,
      &quot;p1&quot;: &quot;1&quot;,
      &quot;p2&quot;: &quot;6&quot;
     }
     }]
  </code></pre>
  <p><strong>code</strong></p>
  <pre><code>import json
  with open(&quot;data.json&quot;, 'r') as json_file:
   json_decoded = json.load(json_file)
  for x in json_decoded:
   x['fields'] = ''
   with open(&quot;output.json&quot;, 'w') as json_out_file:
   json.dump(json_decoded, json_out_file, indent=2, ensure_ascii=False)
  </code></pre>
  <p>with this code I am able to add elements inside json objects, but my expected results is different.</p>
  <p>output of my code is</p>
  <pre><code>   [
       {
        &quot;Full Address&quot;: &quot;data1&quot;,
        &quot;p1&quot;: &quot;1&quot;,
        &quot;p2&quot;: &quot;6&quot;,
        &quot;fields&quot;: &quot; &quot;
       },
       {
      &quot;Full Address&quot;: &quot;data2&quot;,
      &quot;p1&quot;: &quot;1&quot;,
      &quot;p2&quot;: &quot;6&quot;,
      &quot;fields&quot;: &quot; &quot;
      }
    ]
  </code></pre>
  <p><a href="https://i.stack.imgur.com/iNSpX.png" rel="nofollow noreferrer">Picture</a></p>