title: Python json.dumps with string interpolation?
body: <p>Let's say I want to create a json object following the structure:</p>
  <pre><code>{&quot;favorite_food&quot;:[&quot;icecream&quot;,&quot;hamburguers&quot;]}
  </code></pre>
  <p>to do so in python, if i know the whole string in advance, I can just do:</p>
  <pre><code>json.dumps({&quot;favorite_food&quot;:[&quot;icecream&quot;,&quot;hamburguers&quot;]})
  </code></pre>
  <p>which works fine.</p>
  <p>my question though is, how would i do the same thing if i wanted to get the object as a result of a string interpolation? For example:</p>
  <pre><code>favorite food = 'pizza'
  json.dumps({&quot;favorite_food&quot;:[%s]}) %favorite_food
  </code></pre>
  <p>the issue i found is, if I do the interpolation prior to calling the <code>json.dumps</code>:</p>
  <pre><code>dict=  '{&quot;favorite_food&quot;:[%s]}' % favorite_food
  </code></pre>
  <p>if i then do <code>json.dumps(dict)</code> , because of the string quotation, the json_dumps returns:</p>
  <pre><code>{&quot;favorite_food&quot;:[pizza]}
  </code></pre>
  <p>that is, is not a dict anymore (but a string with the structure of a dict)</p>
  <p>How can i solve this simple issue?</p>