Flat JSON object parser with pointed errors

Kotlin
class JsonError(message: String) : Exception(message)

fun parseFlatJson(src: String): Map<String, String> {
    val text = src.trim()
    if (!text.startsWith("{") || !text.endsWith("}")) throw JsonError("not a JSON object: $text")
    val body = text.substring(1, text.length - 1).trim()
    if (body.isEmpty()) return emptyMap()
    val out = LinkedHashMap<String, String>()
    // flat key/value entries only: no nested values or commas inside strings
    for (entry in body.split(',')) {
        val colon = entry.indexOf(':')
        if (colon < 0) throw JsonError("missing ':' in entry: $entry")
        val key = entry.substring(0, colon).trim().removeSurrounding('"')
        if (key.isEmpty()) throw JsonError("empty key in entry: $entry")
        if (out.put(key, entry.substring(colon + 1).trim().removeSurrounding('"')) != null) {
            throw JsonError("duplicate key: $key")
        }
    }
    return out
}