美文网首页
Data class的Moshi/Gson实现方式:

Data class的Moshi/Gson实现方式:

作者: Sarah_love | 来源:发表于2021-01-28 12:38 被阅读0次

    1.GSON解析:

    import com.google.gson.annotations.SerializedName

    public class ScheduleMessagesRequest {

    @SerializedName("wedding_id")

    public StringweddingId;

        @SerializedName("member_id")

    public StringmemeberId;

        @SerializedName("sequence_id")

    public StringsequenceId;

    }

    2.  Moshi解析:

    import com.squareup.moshi.Json

    import com.squareup.moshi.JsonClass

    @JsonClass(generateAdapter = true)

    data class PasswordPayload(

    @Json(name = "email")

    var email: String? =null,

            @Json(name = "password")

    var password: String? =null,

            @Json(name = "new_password")

    var newPassword: String? =null,

            @Json(name = "new_password_confirmation")

    var confirmPassword: String? =null)

    相关文章

      网友评论

          本文标题:Data class的Moshi/Gson实现方式:

          本文链接:https://www.haomeiwen.com/subject/awsuzktx.html