Created
March 9, 2022 20:25
-
-
Save zehpatricio/e58763ab3dfc56c5316675eb73b413a9 to your computer and use it in GitHub Desktop.
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
import kotlinx.serialization.* | |
import kotlinx.serialization.json.* | |
@Serializable | |
class Endereco( | |
val planeta: String, | |
val galaxia: String, | |
) | |
@Serializable | |
class Aluno( | |
val nome: String, | |
val media: Float, | |
val endereco: Endereco, | |
) | |
fun main() { | |
val endereco = Endereco("Tatooine", "Outer Rim") | |
val aluno = Aluno("Luke Skywalker", 9.8f, endereco) | |
println(Json.encodeToString(aluno)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment