StringWriter w = new StringWriter();
System.setProperty("org.apache.wink.common.model.json.factory.impl", "org.apache.wink.json4j.compat.impl.ApacheJSONFactory");
JSONFactory factory = JSONFactory.newInstance();
JSONWriter jWriter = factory.createJSONWriter(w);
jWriter.object();
jWriter.key("foo");
jWriter.value("bar");
jWriter.close();
String str = w.toString();
// Verify it parses.
JSONObject test = factory.createJSONObject(str);