RestEasy : org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token(..)

后端 未结 1 504
無奈伤痛
無奈伤痛 2021-01-21 04:45

I have a rest endpoint which returns List. I am trying to test this rest endpoint as

    @Test
    public void testGet         


        
1条回答
  •  盖世英雄少女心
    2021-01-21 05:21

    That looks like a Jackson error, where it's expecting to parse an array (which would begin with a '[') but it's encountering the beginning token for an object ('{'). From looking at your code, Im guessing it's trying deserialise JSON into your List but it's getting the JSON for an object.

    What does the JSON your REST endpoint returns look like? It ought to look like this

    [
        {
            // JSON for VariablePresentation value 0
            "field0": 
            
        },
        
    ]
    

    0 讨论(0)
提交回复
热议问题