вариант, но получаю крэш
val objectMapper = ObjectMapper()
objectMapper.typeFactory
val messagesList = objectMapper.readValue<List<Message>>(data!!, object : TypeReference<List<Message>>() {})
Крэш:
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of com.opet.Message (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
public List<QuestionModel> getQuestionnaireModel() { Gson gson = new Gson(); Type listType = new TypeToken<ArrayList<QuestionModel>>() { }.getType(); return gson.fromJson(getForm_data(), listType); }
Обсуждают сегодня