I think it really depends on the implementation of Java EE 7. For Glass Fish, you can just pass null for the Json.createXXXFactory () methods, except for the Json.createWriterFactory / createGeneratorFactory () method, which you could pass in with the configuration parameter, whether do pretty printed or not.
Map<String, Object> config = new HashMap<String, Object>();
source share