Added a convenience method Any.toJson()

This commit is contained in:
Fabian Schlenz 2017-12-17 11:39:31 +01:00
parent 28931830eb
commit 93ad47639f
1 changed files with 5 additions and 0 deletions

View File

@ -181,3 +181,8 @@ object Utils {
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)
}