asJsonObject
Narrows a properties map to a JsonObject, wrapping only when it is not already one.
This exists because a public parameter may not be declared JsonObject if Swift can reach it. Kotlin/Native bridges a Swift dictionary to NSDictionaryAsKMap — a runtime wrapper implementing kotlin.collections.Map — and passes it into a parameter declared as a Map subtype with no check at all. The header still renders that parameter as a plain NSDictionary (it is one, by supertype), so the call compiles and the object arrives non-null; reading it through the declared type then reads a layout the object does not have, and the process dies with SIGSEGV rather than a Kotlin exception — no Uncaught Kotlin exception: line, no crash report (#193). Whether a given call survives is an accident of whether anything happens to touch the value through its declared type, so "it works today" is not evidence of safety.
Declaring the interface type instead makes the bridge convert properly, in both directions, and costs one is check here. Kotlin callers are unaffected: JsonObject is a Map<String, JsonElement>, so they keep passing exactly what they passed before, and the check below short-circuits for them.