Deserialize a json array to objects using Jackson and WebClient

前端 未结 3 1781
失恋的感觉
失恋的感觉 2020-12-31 02:53

I have a problem during the deserialization of a json array using Spring. I have this json response from a service:

[
    {
        \"symbol\": \"XRPETH\",
          


        
3条回答
  •  青春惊慌失措
    2020-12-31 03:13

    Your response is simply List. But, your POJO has wrapped List. So, according to your POJO, your JSON should be

    {
      "accountOrders": [
        {
    

    But, you are JSON is

    [
        {
           "symbol": "XRPETH",
           "orderId": 12122,
            ....
    

    So, there is mismatch and failing the deserialization. You need to change to

    bodyToMono(AccountOrder[].class)
    

提交回复
热议问题