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
Post a Comment