Field field = JSONWriter.class.getDeclaredField("context");
field.setAccessible(true);
StringWriter out = new StringWriter();
JSONWriter writer = new JSONWriter(out);
writer.config(SerializerFeature.UseSingleQuotes, true);
writer.startObject();
Object context = field.get(writer);
Field stateField = context.getClass().getDeclaredField("state");
stateField.setAccessible(true);