I would also complete the solution, where loaded JSON data via REST are transformed (mapped) into deep Array, otherwise you can loose methods like toString()
suspend fun getAvailableBooks(): Array<Book> =
window
.fetch("/json/gson")
.await()
.json()
.await()
.unsafeCast<Array<Book>>()
.map {
Book(
Isbn(it.isbn.value),
BookName(it.name.value),
Credit(it.credit.value)
)
}
.toTypedArray()