Why can't I fetch nested data from json using Gson?
问题 I have a json I fetch from an API that looks like this: {"success":true,"message":"","result":{"Bid":6886.97100000,"Ask":6891.58500000,"Last":6891.58500000}} All I want is to just save Bid and Ask values in fields of a class. First I parse whole json like this: val response = sendRequest(url)) val gson = Gson() val ticker : MarketTickerEntity = gson.fromJson(response, MarketTickerEntity::class.java) And then I try to parse it inside of my class init block and reassign to bid and ask fields.