There are many efficient and accurate libraries that serve as an ORM and bind your JSON response to a model. Jackson is one of them. Google's GSON and Square.io's Moshi are some popular libraries.
In a static lambda function, there is the mapper.writeValue line. A mapper object is defined in a separate file named Mapper.kt. And the file has the following source code:
val mapper = jacksonObjectMapper().apply { setSerializationInclusion(JsonInclude.Include.NON_NULL) }