title: toJSONString() is undefined for the type JSONObject
body: <p>My code to create a new JSONObject and write to a file:</p>
  
  <pre><code>JSONObject obj = new JSONObject();
  obj.put("name", "abcd");
  obj.put("age", new Integer(100));
  JSONArray list = new JSONArray();
  list.add("msg 1");
  list.add("msg 2");
  list.add("msg 3");
  obj.put("messages", list);
  try {
      FileWriter file = new FileWriter("c:\\test.json");
      file.write(obj.toJSONString());
      file.flush();
      file.close();    
  } catch (IOException e) {
      e.printStackTrace();
  }
  System.out.print(obj);
  </code></pre>
  
  <p>My problem is at</p>
  
  <pre><code>file.write(obj.toJSONString());
  </code></pre>
  
  <p>It says that </p>
  
  <blockquote>
    <p>The method toJSONString() is undefined for the type JSONObject.</p>
  </blockquote>
  
  <p>Am I missing any library? Or am I going about it wrong? Is there alternative way to do it?</p>