I'm using the Kotlin language together with the GSON library to do parse creation / parsing of JSON objestos.
I have the following string that stores 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, 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
is a JSONArray and not a primitive type, but anyway I'd like to know how to convert this string to a JSON Object correctly.