Firebase serialization names

后端 未结 3 1516
轻奢々
轻奢々 2021-01-12 18:52

I created an object to send some data to firebase. As an example, I use firebase user example:

public class User {
    public String username;
    public Str         


        
3条回答
  •  日久生厌
    2021-01-12 19:36

    What you are looking for is the feature of SDK Version 9.2 in which you can now use a new @PropertyName attribute to specify the name to use when serializing a field from a Java model class to the database. This replaces the @JsonProperty attribute.

    @PropertyName("Username")
    public String username;
    @PropertyName("Email")
    public String email;
    

    See also this post in which Frank van Puffelen explains very clearly this concept.

提交回复
热议问题