[Solved] JSON parse error: Cannot deserialize instance of `java.util.ArrayList<..> out of START_OBJECT token;

JSON parse error: Cannot deserialize instance of java.util.ArrayList<com.sangfor.ngsoc.knowledge.to.UserEntity> out of START_OBJECT token;
1. problem replication
① First, configure both knowledge and auth services into eureka.

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:8761/eureka/

② The project path of auth service is:

server:
  port: 8081
  servlet.context-path: /ngso/AUTH/

③ Interface of remote auth service:

@Api(tags = "Usersheet")
@Slf4j
@Validated
@RestController
@ResponseResult
@RequestMapping("/api/v2")
public class UserController {

    @Autowired
    private IUserService userService;

    @PostMapping("/users/inner/exact")
    public PageData<UserEntity> exactPageQueryUserList(@Validated @RequestBody UserQo userQo,
                                                       @RequestParam(SessionKey.DOMAIN_ID) String domainId) {
        userQo.setDomainId(domainId);
        return userService.exactPageQueryUserList(userQo);
    }
}

④ Feign interface of knowledge service, calling the interface of remote auth service:

@FeignClient(name = "AUTH")
public interface AuthFeignService {
    @PostMapping("/ngso/AUTH/api/v2/users/inner/exact")
    PageData<UserResp> exactPageQueryUserList(
            @RequestBody UserReqDto userReqDto,
            @RequestParam(SessionKey.DOMAIN_ID) String domainId);
}

(5) calling feign interface in knowledge service:

@Override
public String addDoc() {
    List<String> userIds = new ArrayList<>();
     UserInfo userInfo = UserInfoShareHolder.getUserInfo();
    userIds.add(userInfo.getId());
    UserReqDto userReqDto = new UserReqDto(userIds);
    userReqDto.setPageNum(1);
    userReqDto.setPageSize(1);
    PageData<UserResp> pageDataApiResponse = authFeignService
        .exactPageQueryUserList(userReqDto, UserInfoShareHolder.getUserInfo().getDomainId());
}

Result error:

JSON parse error: Cannot deserialize instance of `java.util.ArrayList<com.sangfor.ngsoc.knowledge.to.UserEntity>` out of START_OBJECT token; 

2. Solutions

① First, directly call the auth service interface without using the remote service: localhost: 8081/NGSO/auth/API/V2/users/inner/exact

There are more code and message messages than the actual response data, indicating that the response data is encapsulated

{
    "code": 0,
    "message": "成功",
    "data": {
        "pageNum": 1,
        "pageSize": 1,
        "totalCount": 1,
        "data": [
            {
                "id": "fx-user-fec844b9e0dc0d80000004",
                "name": "sysadmin",
                "phone": "",
                "email": "",
                "description": "Built-in user: default platform system administrator account",
                "domainId": "fx-domain-fec833bfa0dbcc40000001",
                "projectId": " ",
                "enabled": 1,
                "createTime": "2021-10-18 15:41:17",
                "updateTime": "2021-10-21 16:35:11",
                "changeTime": "2021-10-18 16:44:37",
                "loginTime": "2021-10-21 16:35:11",
                "options": 0,
                "builtIn": 1
            }
        ]
    }
}

② View the code and add a layer of encapsulation:

@FeignClient(name = "AUTH" )
public interface AuthFeignService {
   @PostMapping("/ngso/AUTH/api/v2/users/inner/exact")
    ApiResponse<PageData<UserResp>> exactPageQueryUserList(
            @RequestBody UserReqDto userReqDto,
            @RequestParam(SessionKey.DOMAIN_ID) String domainId);
}

Read More: