Exception ex = null;
try {
// Verify a malformed JSON string (no closure), fails parse.
System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
JSONFactory factory = JSONFactory.newInstance();
JSONObject jObject = factory.createJSONObject("{\"foo\":\"bar\", \"bool\": true");
assertTrue(jObject.getBoolean("bool") == true);
System.out.println("JSON compacted text (jObject):\n");
System.out.println(jObject.toString());
} catch (Exception ex1) {
ex = ex1;