kotlin hashmap to json code example

Example: kotlin hashmap to object

Ok I found the solution

I transformed my Bundle class in a data class :

data class Bundle(
    var version: String? = null,
    var app: String? = null,
    var countries: ArrayList<Any> = arrayListOf(),
    var currency: HashMap<String, Any> = hashMapOf(),
    var force: Boolean = false,
    var name: String? = null,
    var service: ArrayList<Any> = arrayListOf(),
    var money: Int = 0
)
And then I simply added this on my method , where I want to convert my Map to my Bundle Object :

val myObject = document.toObject(Bundle::class.java)