title: How to give one space between number in json string java?
body: <p>In my below code, I am making a json string using gson:</p>
  
  <pre><code>private String generateData(Map&lt;String, Map&lt;Integer, Set&lt;Integer&gt;&gt;&gt; nodeTable, int i) {
      JsonObject jsonObject = new JsonObject();
  
      Set&lt;Integer&gt; pp = nodeTable.get("TEXTER").get(i);
      Set&lt;Integer&gt; sp = nodeTable.get("PETER").get(i);
  
      // my above pp and sp variables shows correct values with one space between numbers.
  
      jsonObject.addProperty("description", "Hello. World");
      jsonObject.add("data1", gson.toJsonTree(pp));
      jsonObject.add("data2", gson.toJsonTree(sp));
  
      System.out.println(jsonObject.toString());
  
      return jsonObject.toString();
  }
  </code></pre>
  
  <p>When I get my json string, I get it like this. As you can see after comma everything is next to each other without any spaces. I don't want like that.</p>
  
  <pre><code>{"description":"Hello. World.","data1":[0,273,546,819,1092,559],"data2":[816,1644,1368,276]}
  </code></pre>
  
  <p>I want to have one space between numbers in data1 and data2 variable as shown below:</p>
  
  <pre><code>{"description":"Hello. World.","data1":[0, 273, 546, 819, 1092, 559],"data2":[816, 1644, 1368, 276]}
  </code></pre>
  
  <p>Is this possible to do by any chance using gson or some other way?</p>