0
I am using the Kotlin language together with the GSON library to perform JSON object creation/parse.
I have the following string that caches a JSON object returned from a server
val jsonString = "{"age":22,"height":1.8,"profession":"Student","at_room":false,"gender":"male","pictures":[ ]}"
When I try to convert this string to a JSON Object by doing
val jsonData = JsonParser().parse(jsonString).asJsonObject
i get the following error: [] cannot be converted to JSON
I think the error is due to the fact that pictures
be a Jsonarray and not a primitive type, but anyway I would like to know how to convert this string to a JSON Object correctly.