Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
slightly optimize json marshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
Stebalien committed Oct 19, 2018
1 parent 7b96843 commit f04fb2d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions notifications/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ func PublishQueryEvent(ctx context.Context, ev *QueryEvent) {
}

func (qe *QueryEvent) MarshalJSON() ([]byte, error) {
out := make(map[string]interface{})
out["ID"] = peer.IDB58Encode(qe.ID)
out["Type"] = int(qe.Type)
out["Responses"] = qe.Responses
out["Extra"] = qe.Extra
return json.Marshal(out)
return json.Marshal(map[string]interface{}{
"ID": peer.IDB58Encode(qe.ID),
"Type": int(qe.Type),
"Responses": qe.Responses,
"Extra": qe.Extra,
})
}

func (qe *QueryEvent) UnmarshalJSON(b []byte) error {
Expand Down

0 comments on commit f04fb2d

Please sign in to comment.