fromJson

fun <T> String.fromJson(type: Type): T?

Below method uses generics and can convert JSONString to Any type of object depending on the type provided

Ex: json.fromJson(Object::class.java)