Пример #1
0
func (h *Header) UnmarshalJSON(data []byte) error {
	if h.EssentialHeader == nil {
		h.EssentialHeader = &EssentialHeader{}
	}
	if h.PrivateParams == nil {
		h.PrivateParams = map[string]interface{}{}
	}
	return emap.MergeUnmarshal(data, h.EssentialHeader, &h.PrivateParams)
}
Пример #2
0
// UnmarshalJSON parses the JSON representation and initializes this ClaimSet
func (c *ClaimSet) UnmarshalJSON(data []byte) error {
	if c.EssentialClaims == nil {
		c.EssentialClaims = &EssentialClaims{}
	}
	if c.PrivateClaims == nil {
		c.PrivateClaims = map[string]interface{}{}
	}
	return emap.MergeUnmarshal(data, c.EssentialClaims, &c.PrivateClaims)
}