You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Message object
*/
public class Message implements Validable {
@SerializedName("action")
private MessageAction action;
/**
Only for messages from community. Contains user ID of community admin, who sent this message.
*/
@SerializedName("admin_author_id")
private Integer adminAuthorId;
@SerializedName("attachments")
private List attachments;
/**
Unique auto-incremented number for all messages with this peer
*/
@SerializedName("conversation_message_id")
private Integer conversationMessageId;
/**
Date when the message has been sent in Unixtime
*/
@SerializedName("date") @required
private Integer date;
/**
Is it an deleted message
*/
@SerializedName("deleted")
private BoolInt deleted;
/**
Message author's ID
*/
@SerializedName("from_id")
private Integer fromId;
/**
Forwarded messages
*/
@SerializedName("fwd_messages")
private List fwdMessages;
@SerializedName("geo")
private Geo geo;
/**
Message ID
*/
@SerializedName("id") @required
private Integer id;
/**
Is it an important message
*/
@SerializedName("important")
private Boolean important;
приходит json вида:
`
{
"group_id" : <group_id>,
"type" : "message_new",
"event_id" : "<event_id>",
"v" : "5.131",
"object" : {
"message" : {
"date" : 1672387895,
"from_id" : <from_id>,
"id" : ,
"out" : 0,
"attachments" : [
],
"conversation_message_id" : <conversation_message_id>,
"fwd_messages" : [
],
"important" : false,
"is_hidden" : false,
"peer_id" : 8342610,
"random_id" : 0,
"text" : "ывц3к4ас уавау"
},
"client_info" : {
"button_actions" : [
"text",
"vkpay",
"open_app",
"location",
"open_link",
"open_photo",
"callback",
"intent_subscribe",
"intent_unsubscribe"
],
"keyboard" : true,
"inline_keyboard" : true,
"carousel" : true,
"lang_id" : 0
}
}
}
`
В sdk парсинг джейсона в класс происходит в 2 этапа:
`public class CallbackMessage {
`
где object с типом JsonObject получает значение:
{ "message" : { "date" : 1672387895, "from_id" : <from_id>, "id" : <id>, "out" : 0, "attachments" : [ ], "conversation_message_id" : <conversation_message_id>, "fwd_messages" : [ ], "important" : false, "is_hidden" : false, "peer_id" : 8342610, "random_id" : 0, "text" : "ывц3к4ас уавау" }, "client_info" : { "button_actions" : [ "text", "vkpay", "open_app", "location", "open_link", "open_photo", "callback", "intent_subscribe", "intent_unsubscribe" ], "keyboard" : true, "inline_keyboard" : true, "carousel" : true, "lang_id" : 0 } }
и имеет структуру
мы пытаемся попарсить
[ "message" : {...}, "client_info" : {...} ]
в класс
`
/**
Message object
*/
public class Message implements Validable {
@SerializedName("action")
private MessageAction action;
/**
*/
@SerializedName("admin_author_id")
private Integer adminAuthorId;
@SerializedName("attachments")
private List attachments;
/**
*/
@SerializedName("conversation_message_id")
private Integer conversationMessageId;
/**
*/
@SerializedName("date")
@required
private Integer date;
/**
*/
@SerializedName("deleted")
private BoolInt deleted;
/**
*/
@SerializedName("from_id")
private Integer fromId;
/**
*/
@SerializedName("fwd_messages")
private List fwdMessages;
@SerializedName("geo")
private Geo geo;
/**
*/
@SerializedName("id")
@required
private Integer id;
/**
*/
@SerializedName("important")
private Boolean important;
@SerializedName("is_hidden")
private Boolean isHidden;
/**
*/
@SerializedName("is_cropped")
private Boolean isCropped;
@SerializedName("keyboard")
private Keyboard keyboard;
/**
*/
@SerializedName("members_count")
private Integer membersCount;
/**
*/
@SerializedName("out")
@required
private BoolInt out;
@SerializedName("payload")
private String payload;
/**
*/
@SerializedName("peer_id")
private Integer peerId;
/**
*/
@SerializedName("random_id")
private Integer randomId;
@SerializedName("ref")
private String ref;
@SerializedName("ref_source")
private String refSource;
@SerializedName("reply_message")
private ForeignMessage replyMessage;
/**
*/
@SerializedName("text")
@required
private String text;
/**
*/
@SerializedName("update_time")
private Integer updateTime;
/**
*/
@SerializedName("was_listened")
private Boolean wasListened;
/**
*/
@SerializedName("pinned_at")
private Integer pinnedAt;
/**
*/
@SerializedName("is_silent")
private Boolean isSilent;
...
}
`
и получаем null
тк есть лишний объект "client_info" : {...}
The text was updated successfully, but these errors were encountered: