title: difference between str(dict) and json.dumps(dict)
body: <p>What is the difference between the output of <code>str(a dictionary)</code> and <code>json.dumps(a dictionary)</code>? If I print them, they look the same. Their attributes (as per <code>dir</code>) also seem to be identical (see below). Yet I know there must be a difference. Could you please explain it to me?</p>
  
  <pre><code>import json
  
  aDictionary= {"first": 42, "second":21}
  s = str(aDictionary)
  j = json.dumps(aDictionary)
  s == j # returns false
  dir(s) == dir(j) # returns true
  </code></pre>