val command = """{"type":"Modify", "content":{"levels": { "$identifier": {"$propertyName":"$value"}}}}"""
This is obviously very bad code as any of the variables can easily break JSON. What would be "kotlin-way"? I'm looking for some concise solution. 🙂 Thanks
PS: I use Kotlin 1.1.4
k
karelpeeters
08/21/2017, 7:34 AM
Copy code
fun String.escape() = this.replace('\t', "\\t").replace('\n',"\\n")...