title: Remove duplicates from a Json String in Java?
body: <p>I have a Json String with duplicate values:</p>
  
  <pre>
  String json = "{\"Sign_In_Type\":\"Action\",\"Sign_In_Type\":\"Action\"}";
  </pre>
  
  <p>that correctly throws an exception when I try to create a JSONObject:</p>
  
  <pre>
  
     try {
              JSONObject json_obj = new JSONObject(json);
              String type = json_obj.getString("Sign_In_Type");
          } catch (JSONException e) {
              throw new RuntimeException(e);
          }
  </pre>
  
  <p>Error: </p>
  
  <pre>
  Exception in thread "main" java.lang.RuntimeException: org.json.JSONException: Duplicate key "Sign_In_Type"
      at com.campanja.app.Upload.main(Upload.java:52)
  Caused by: org.json.JSONException: Duplicate key "Sign_In_Type"
      at org.json.JSONObject.putOnce(JSONObject.java:1076)
      at org.json.JSONObject.(JSONObject.java:205)
      at org.json.JSONObject.(JSONObject.java:402)
      at com.campanja.app.Upload.main(Upload.java:49)
  </pre>
  
  <p>Is there a smart way of removing or checking for duplicates before I convert it to a JSONOBject?
  I have tried to create:</p>
  
  <pre>
   Set set = new HashSet(Arrays.asList(json));
  </pre>
  
  <p>but that gives me:</p>
  
  <pre>
  [{"Sign_In_Type":"Action","Sign_In_Type":"Action"}]
  </pre>
  
  <p>Any suggesstions welcome, thanks!</p>