title: pickle.dumps output size increases when input is generated using json.loads
body: <p>In Python 2.7.16:</p>
  <pre class="lang-py prettyprint-override"><code>import json
  import pickle
  
  list1 = [{u'key': 1}, {u'key': 2}]
  list2 = json.loads('[{&quot;key&quot;: 1}, {&quot;key&quot;: 2}]')
  
  pickle.dumps(list1)
  # outputs '(lp0\n(dp1\nVkey\np2\nI1\nsa(dp3\ng2\nI2\nsa.'
  
  pickle.dumps(list2)
  # outputs '(lp0\n(dp1\nVkey\np2\nI1\nsa(dp3\nVkey\np4\nI2\nsa.'
  </code></pre>
  <p>Why is the output of <code>pickle.dumps</code> different for <code>list1</code> and for <code>list2</code>?</p>
  <p>The output of <code>pickle.dumps(list1)</code> only contains the string <code>key</code> once, despite <code>key</code> being present in both list entries, so there appears to be some optimisation there. However, the output of <code>pickle.dumps(list2)</code> contains two instances of the string <code>key</code>.</p>