JSONWriter jWriter = factory.createJSONWriter(w);
jWriter.object();
jWriter.key("foo");
// Verify we can put a JSONObject into the stream!
JSONObject jObj = factory.createJSONObject();
jObj.put("foo", true);
jWriter.value(jObj);
jWriter.endObject();
jWriter.close();
String str = w.toString();
// Verify it parses.
JSONObject test = factory.createJSONObject(str);
assertTrue(str.equals("{\"foo\":{\"foo\":true}}"));
}catch(Exception ex1){
ex = ex1;
ex.printStackTrace();
}