StringWriter ddWriter = new StringWriter();
JSONObject designDoc = new JSONObject();
try {
jsonLoader.write(ddWriter);
JSONTokener jsonTokener = new JSONTokener(ddWriter.toString());
Object obj = jsonTokener.nextValue();
if( obj instanceof JSONObject ) {
designDoc = (JSONObject)obj;
} else {
throw new Exception("Unexpected returned object type: "+obj.getClass().getSimpleName());
}