title: Which is the best way to compress json to store in a memory based store like redis or memcache?
body: <p>Requirement :
  Python objects with 2-3 levels of nesting containing basic datypes like integers,strings, lists, and dicts.
  ( no dates etc), needs to be stored as json in redis against a key.
  What are the best methods available for compressing json as a string for low memory footprint.
  The target objects are not very large, having 1000 small elements on average, 
  or about 15000 characters when converted to JSON.</p>
  
  <p>eg.</p>
  
  <pre><code>&gt;&gt;&gt; my_dict
  {'details': {'1': {'age': 13, 'name': 'dhruv'}, '2': {'age': 15, 'name': 'Matt'}}, 'members': ['1', '2']}
  &gt;&gt;&gt; json.dumps(my_dict)
  '{"details": {"1": {"age": 13, "name": "dhruv"}, "2": {"age": 15, "name": "Matt"}}, "members": ["1", "2"]}'
  ### SOME BASIC COMPACTION ###
  &gt;&gt;&gt; json.dumps(my_dict, separators=(',',':'))
  '{"details":{"1":{"age":13,"name":"dhruv"},"2":{"age":15,"name":"Matt"}},"members":["1","2"]}'
  </code></pre>
  
  <p>1/ Are there any other better ways to compress json to save memory in redis ( also ensuring light weight decoding afterwards ).</p>
  
  <p>2/ How good a candidate would be msgpack [http://msgpack.org/] ?</p>
  
  <p>3/ Shall I consider options like pickle as well ?</p>