Last active
June 17, 2022 17:37
-
-
Save aslamanver/8c5d5e88d6a4cc29cf7c2de291485d50 to your computer and use it in GitHub Desktop.
Convert Java/Kotlin object to another object - 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T> Any.convert(classOfT: Class<T>): T = Gson().fromJson(Gson().toJson(this), classOfT) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment