How to parse JSON in Kotlin?

I’m receiving a quite deep JSON object string from a service which I must parse to a JSON object and then map it to classes.

How can I transform a JSON string to object in Kotlin?

After that the mapping to the respective classes, I was using StdDeserializer from Jackson. The problem arises at the moment the object had properties that also had to be deserialized into classes. I was not able to get the object mapper, at least I didn’t know how, inside another deserializer.

Preferably, natively, I’m trying to reduce the number of dependencies I need so if the answer is only for JSON manipulation and parsing it’d be enough.

16 Answers
16

Leave a Comment