title: How do you set a value to null with com.google.gson.JsonObject in java?
body: <p>How do you set a value to null with <code>com.google.gson.JsonObject</code> in java? I can certainly read if a value is null by using isNull - but it seems like when I put null, it just ignores it:</p>
  
  <pre><code>JSONObject jsonObj = new JSONObject();
  jsonobjToEra.addProperty("sun", Double.parseDouble(val));
  jsonobjToEra.addProperty("mon", 22.333);
  jsonobjToEra.addProperty("val", null); //ignoring it
  </code></pre>
  
  <p>Please note that I am using <code>com.google.gson.JsonObject</code> which is different from similar questions like <a href="https://stackoverflow.com/questions/13613754/how-do-you-set-a-value-to-null-with-org-json-jsonobject-in-java">How do you set a value to null with org.json.JSONObject in java?</a> in other posts in this SO.</p>
  
  <p><strong>The JSON:</strong></p>
  
  <pre><code>[
    {
      "sun": 1122435343453,
      "mon": 1460538600000,
      "val": 45.900001525878906
    },
    {
      "sun": 1460538600000,
      "mon": 1460538660000,
      "val": 45.900001525878906
    }
    ]
  </code></pre>