Narrows an object of type T
to a JsonMap
using a shallow type-compatibility check. Use this when the source of
the object is known to be JSON-compatible and you want simple type coercion to a JsonMap
. Use toJsonMap
instead when the value
object cannot be guaranteed to be JSON-compatible and you want an assurance of runtime
type safety. This is a shortcut for writing asJsonMap(coerceAnyJson(value)) ?? defaultValue
.
Narrows an object of type
T
to aJsonMap
using a shallow type-compatibility check. Use this when the source of the object is known to be JSON-compatible and you want simple type coercion to aJsonMap
. Use toJsonMap instead when thevalue
object cannot be guaranteed to be JSON-compatible and you want an assurance of runtime type safety. This is a shortcut for writingasJsonMap(coerceAnyJson(value))
.