package org.json // Serialization-only JVM double; actual Android JSONObject API compiled in normal build. class JSONObject() { constructor(text: String) : this() { error("Parser is outside this double's scope") } private val fields = linkedMapOf() fun put(key: String, value: Any): JSONObject { fields[key] = value; return this } fun opt(key: String): Any? = fields[key] override fun toString(): String = fields.entries.joinToString(",", "{", "}") { (key, value) -> "\"$key\":" + if (value is String) "\"$value\"" else value.toString() } }