JsonMappingException: No suitable constructor found

后端 未结 4 828
既然无缘
既然无缘 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:31

    Firebase uses -JRHTHaIs-jNPLXOQivY as the key to your object

    {
     author: "gracehop"
     title: "Announcing COBOL, a New Programming Language"
    }
    

    You have to use this as the key to acces the object. You will have to send the correct request to the api. In this case it will be

    https://docs-examples.firebaseio.com/web/saving-data/fireblog/posts/-JRHTHaIs-jNPLXOQivY

    If you want to receive an array from Firebase you'll have to store it like this.

    posts{
         "1":{
              author: "gracehop"
              title: "Announcing COBOL, a New Programming Language"
            },
         "2":{
             author: "alanisawesome"
             title: "The Turing Machine"
            }
    }
    

    Firebase has no native support for arrays. If you store an array, it really gets stored as an “object” with integers as the key names.

    Check out this Firebase blog post for more information

提交回复
热议问题