File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -601,6 +601,30 @@ type ForumTag struct {
601
601
EmojiName string `json:"emoji_name,omitempty"`
602
602
}
603
603
604
+ // Sometimes ID is a number instead of a string, so we need to unmarshal it manually
605
+ func (t * ForumTag ) UnmarshalJSON (data []byte ) error {
606
+ temp := struct {
607
+ ID json.Number `json:"id,omitempty"`
608
+ Name string `json:"name"`
609
+ Moderated bool `json:"moderated"`
610
+ EmojiID string `json:"emoji_id,omitempty"`
611
+ EmojiName string `json:"emoji_name,omitempty"`
612
+ }{}
613
+
614
+ err := json .Unmarshal (data , & temp )
615
+ if err != nil {
616
+ return err
617
+ }
618
+
619
+ t .ID = temp .ID .String ()
620
+ t .Name = temp .Name
621
+ t .Moderated = temp .Moderated
622
+ t .EmojiID = temp .EmojiID
623
+ t .EmojiName = temp .EmojiName
624
+
625
+ return nil
626
+ }
627
+
604
628
// Emoji struct holds data related to Emoji's
605
629
type Emoji struct {
606
630
ID string `json:"id"`
You can’t perform that action at this time.
0 commit comments