title: How to convert Empty string to null in JsonArray ( com.google.gson)
body: <p>My JSON Object has some empty values ("") So While converting it throws error.</p>
  
  <p><strong>Here's my JSON</strong> </p>
  
  <pre><code>{
      "Animals": [
          {
              "id": 6140,
              "Name": ""
          },
          {
              "id": 6144,
              "Name": "Lion"
          }
      ]
  }
  </code></pre>
  
  <p><strong>My Code:</strong></p>
  
  <pre><code>JsonParser parser=new JsonParser();
  JsonArray myarray=parser.parse(json).getAsJsonArray();
  </code></pre>
  
  <p>I'm getting the error as </p>
  
  <blockquote>
    <p>com.google.gson.stream.malformedjsonexception</p>
  </blockquote>
  
  <p>How do I convert the empty string values into null while parsing the JSON object as a JSONArray?</p>
  
  <p>I want the final result to be</p>
  
  <pre><code>[{id=6140, Name=null},{id=6144, Name="Lion"}] 
  </code></pre>