public String toVoJSONString ( boolean pretty ) { if ( pretty ) { return JSON . toJSONStringWithDateFormat ( toVoJSONObject ( ) , Constant . DATE_SERIALIZE_FORMAT , SerializerFeature . PrettyFormat ) ; } else { return JSONObject . toJSONStringWithDateFormat ( toVoJSONObject ( ) , Constant . DATE_SERIALIZE_FORMAT ) ; } }
No matter context pretty attribute is true or not this method formats the json string you want .