title: Escape values of a JSON String without breaking the JSON
body: <p>I'm trying to escape the values from a JSON-String and remove HTML chars (Like "&lt;script&gt;" etc.) in the backend. I've read that GSON normaly does that itself but in my case not because I'm directly filling the javaobject via "fromJson".</p>
  
  <p>If I'm just using the commons library and escape with escapeString or escapeJson it will also escape the double quotes (") and will break then the fromJson function from GSON.</p>
  
  <p>I'm using following functionality to fill the Object:</p>
  
  <pre><code>Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
  DataObject dObject = gson.fromJson(jsonString, DataObject.class);
  </code></pre>
  
  <p>The json string looks like following (is dynamic):</p>
  
  <pre><code>{"dynamic":[
       {"id":1,"constrain":"1","value_text":"test"},
       {"id":11,"constrain":"1","value_boolean":1},
       ],"name":"Xzzz",
         "prename":"XY",
         "language":"e",
         "email":"x@xy.com"
  }
  </code></pre>
  
  <p>I just want to escape the values of the json string (Like when someone types as name "&lt;script&gt;" it should be escaped as &amp;lt ;script&amp;gt ;)</p>
  
  <p>Has anyone any idea how I could fix that problem?</p>
  
  <p>thanks in advance</p>