Added Any.toPrettyJson().

This commit is contained in:
Fabian Schlenz 2018-01-29 06:13:18 +01:00
parent 004b650762
commit ab16c44de5
2 changed files with 3 additions and 4 deletions

View File

@ -52,6 +52,7 @@ class CommandLineController {
init {
logger.info("CommandLineController started. App version {}", Config.APP_APPVER)
this.printHeader()
if (CommandLineOptions.cmd_version) {
System.exit(0)

View File

@ -182,7 +182,5 @@ fun String.anonymize(): String {
return if (!CommandLineOptions.cmd_anonymize) this else this.replace(Regex("[0-9]"), "1").replace(Regex("[A-Z]"), "A").replace(Regex("[a-z]"), "a") + " (ANONYMIZED)"
}
fun Any.toJson(): String {
return Gson().toJson(this)
}
fun Any.toJson(): String = Gson().toJson(this)
fun Any.toPrettyJson(): String = GsonBuilder().setPrettyPrinting().create().toJson(this)