Narrows an array of type T
to a JsonArray
using a shallow type-compatibility check. Use this when the source of
the array is known to be JSON-compatible and you want simple type coercion to a JsonArray
. Use toJsonArray
instead when the value
array cannot be guaranteed to be JSON-compatible and you want an assurance of runtime
type safety. This is a shortcut for writing asJsonArray(coerceAnyJson(value)) ?? defaultValue
.
Narrows an array of type
T
to aJsonArray
using a shallow type-compatibility check. Use this when the source of the array is known to be JSON-compatible and you want simple type coercion to aJsonArray
. Use toJsonArray instead when thevalue
array cannot be guaranteed to be JSON-compatible and you want an assurance of runtime type safety. This is a shortcut for writingasJsonArray(coerceAnyJson(value))
.