Your json contains an array, but you’re trying to parse it as an object.
This error occurs because objects must start with {
.
You have 2 options:
-
You can get rid of the
ShopContainer
class and useShop[]
insteadShopContainer response = restTemplate.getForObject( url, ShopContainer.class);
replace with
Shop[] response = restTemplate.getForObject(url, Shop[].class);
and then make your desired object from it.
-
You can change your server to return an object instead of a list
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(list);
replace with
return mapper.writerWithDefaultPrettyPrinter().writeValueAsString( new ShopContainer(list));