title: Is it good practice to store JSON object in cookie?
body: <p>I have following object.</p>
  
  <pre><code>position = {
      latitude: 19.067863700000004,
      longitude: 72.9991898,
      pincode: 400701
  }
  </code></pre>
  
  <p>I want to store value of latitude, longitude and pincode in cookie.</p>
  
  <p>I know three ways.</p>
  
  <p>i) store entire <code>position</code> object in cookie.(which is not recommended according to <a href="https://blog.revathskumar.com/2014/07/why-you-should-not-store-json-in-cookie.html" rel="noreferrer">this</a>)</p>
  
  <pre><code>var pos = JSON.stringify(position);
  document.cookie = "position=" + pos;
  </code></pre>
  
  <p>ii) create three cookie <code>latitude</code>, <code>longitude</code> and <code>pincode</code> and store respective value in respective cookie.</p>
  
  <pre><code>document.cookie = "latitude=" + position.latitude;
  document.cookie = "longitude=" + position.longitude;
  document.cookie = "pincode=" + position.pincode;
  </code></pre>
  
  <p>iii) create one cookie <code>position</code> and store value in this cookie is <code>19.067863700000004|72.9991898|400701</code></p>
  
  <pre><code>var pos = position.latitude + "|" + position.longitude + "|" + position.pincode;
  document.cookie = "position=" + pos;
  </code></pre>
  
  <p>My question is <strong>which is best/ideal way to store cookie?</strong>(Give a reason if possible)</p>