title: Strip all nulls from JSON string with regex
body: <p>Given any valid string, is there a reliable regex or algorithm to remove all properties that are set to null?</p>
  
  <pre><code>{
    "prop1":"value1",
    "prop2":null,
    "prop3": "value2",
    "prop4":null
  }
  </code></pre>
  
  <p>Assume that deserialization/serialization libraries cannot be used.  Also JSON is minified and there is no whitespace.</p>
  
  <p>So far I have the follow:</p>
  
  <pre><code>public String replaceNulls(String json){
     json = json.replaceAll("(\"[\w]*\":null,)|(,?\"[\w]*\":null)",""); //regex replace all method
     return json;
  }
  </code></pre>
  
  <p>But I'm not sure it covers all cases.  Even if it does, I have a feeling there might be a more optimized way of doing it.</p>