JsonMappingException: No suitable constructor found

后端 未结 4 830
既然无缘
既然无缘 2020-12-18 08:34

I am implementing a firebase example as given in their documentations. I am facing this error:

com.fasterxml.jackson.databind.JsonMappingException: No

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-18 09:26

    I'm guessing your BlogPost class is an inner class of your activity. In that case Java adds a hidden field to each object that refers to the containing object. And this implicit field is of course not present in your JSON data.

    To solve this, you should either keep the BlogPost class in a separate file (so that it's not an inner class) or mark it as a static class (which removes the implicit field):

    public static class BlogPost {
    

提交回复
热议问题