Java EE 7 Json.createBuilderFactory(config) - what can you do with a non-null config? -


i trying use java ee 7 jsonbuilder , have been having trouble understanding config parameter createbuilderfactory. yes, 1 can leave blank or null, else can 1 do?

jsonbuilderfactory factory = json.createbuilderfactory(config); jsonobject value = factory.createobjectbuilder()     .add("firstname", "john")     .add("lastname", "smith")     .add("age", 25).build(); 

what can 1 config? spacing around colons or commas? line breaks each array? don't know how @ source code, , not appear documented @ java ee page json (http://docs.oracle.com/javaee/7/api/index.html?javax/json/json.html)

i think depends on java ee 7 implementation. glass fish, pass null json.createxxxfactory() methods, except json.createwriterfactory/creategeneratorfactory() method pass configuration option whether pretty printing or not.

        map<string, object> config = new hashmap<string, object>();         //if need pretty printing         config.put("javax.json.stream.jsongenerator.prettyprinting", boolean.valueof(true));         jsonwriterfactory factory = json.createwriterfactory(config); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -