json - prettyPrint jsonNode in Play -


via play ws api get() response object. contains json call

response.asjson() 

which works fine. want return json in prettyprinted version tried call

json.prettyprint(response.asjson()) 

however not work because prettyprint expects jsvalue, not jsonnode. so question how convert jsonnode jsobject?

i guessing using play java. instead of converting jsvalue, like:

jsonnode node = response.asjson(); objectmapper mapper = new objectmapper();  string pretty = mapper.writerwithdefaultprettyprinter().writevalueasstring(node); 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -