title: Redis - Approach for Storing Data Into Redis :: JSON String OR Serialized pojo
body: <p>I have a class like below:</p>
  
  <pre>
     public class Person
        {
           public String name;
           public String age;
        }
  </pre>
  
  <p>I am a bit confused over the approach of saving a Map of Perons into Redis:</p>
  
  <p>Should I go for java serialized/deserialized object approach or should i try converting to JSON and then storing and vice versa.</p>
  
  <p>Any thoughts on below mentioned points:</p>
  
  <ul>
  <li>Cost of serialization and deserialization  VS cost of mapping to Java and to JSON</li>
  <li>memory Requirement for JSON and serialized object for Redis</li>
  <li><p>Compression : Stream vs Data</p>
  
  <p>Which compression should we go for
    Though DATA compression seems a bit difficult(not much benificial) as we are using Redish Hash</p></li>
  </ul>
  
  <p>Some of the assumptions are:</p>
  
  <ul>
  <li>The pojo contain many instancd variables </li>
  <li>will be using Redis hash to store object</li>
  </ul>