Hello! There are the following Json:
[ { "id": 1, "typeOfOrganization": "Администрации", "created_at": 1462136400000 }, { "id": 2, "typeOfOrganization": "Архив", "created_at": 1462136400000 } ] From the application I try to get it like this:
return template.getForObject(Constans.URL.GET_PUBLIC_ORG_ITEM, OrgDTO.class); But at start exception is thrown out:
Caused by: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of com.spravka.dto.OrgDTO out of START_ARRAY token However, if you write this:
OrgDTO[] result = template.getForObject(Constans.URL.GET_PUBLIC_ORG_ITEM, OrgDTO[].class); return result[0]; Everything is normal, but the first element is displayed accordingly: typeOfOrganization - Administration.
What should I do to get the entire list? I suspect that this is due to the fact that json comes in an array [].
result[0], butresult? - Nofate ♦