diff --git a/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt b/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt index 7ce0f709c..fc9a5236c 100644 --- a/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt +++ b/formats/json/jsMain/src/kotlinx/serialization/json/internal/DynamicDecoders.kt @@ -248,7 +248,7 @@ private class DynamicMapInput( if (isKey) { val value = decodeTaggedValue(tag) if (value !is String) return decode(tag) - return value.toString().cast() ?: throwIllegalKeyType(tag, value, type) + return value.cast() ?: throwIllegalKeyType(tag, value, type) } return decode(tag) }