func (n *Note) UnmarshalJSON(data []byte) error {
	doc := &noteAlias{}
	if err := json.Unmarshal(data, doc); err != nil {
		return errors.Wrap(err, "failed to unmarshal Note")
	}
	*n = Note(*doc)
	if n.Attachments == nil {
		n.Attachments = NewFileCollection()
	}
	for _, fv := range n.FieldValues {
		if fv.files != nil {
			if err := n.Attachments.AddView(fv.files); err != nil {
				return err
			}
		}
	}
	n.unmarshaling = true
	if err := n.Validate(); err != nil {
		return err
	}
	n.unmarshaling = false
	return nil
}
// UnmarshalJSON implements the json.Unmarshaler interface for the Note type.
UnmarshalJSON implements the json.Unmarshaler interface for the Note type.
// UnmarshalJSON implements the json . Unmarshaler interface for the Note type .
func (n *Note) UnmarshalJSON(data []byte) error {
	doc := &noteAlias{}
	if err := json.Unmarshal(data, doc); err != nil {
		return errors.Wrap(err, "failed to unmarshal Note")
	}
	*n = Note(*doc)
	if n.Attachments == nil {
		n.Attachments = NewFileCollection()
	}
	for _, fv := range n.FieldValues {
		if fv.files != nil {
			if err := n.Attachments.AddView(fv.files); err != nil {
				return err
			}
		}
	}
	n.unmarshaling = true
	if err := n.Validate(); err != nil {
		return err
	}
	n.unmarshaling = false
	return nil
}
func ( n * Note ) UnmarshalJSON ( data [ ] byte ) error { doc := & noteAlias { } if err := json . Unmarshal ( data , doc ) ; err != nil { return errors . Wrap ( err , " " ) } * n = Note ( * doc ) if n . Attachments == nil { n . Attachments = NewFileCollection ( ) } for _ , fv := range n . FieldValues { if fv . files != nil { if err := n . Attachments . AddView ( fv . files ) ; err != nil { return err } } } n . unmarshaling = true if err := n . Validate ( ) ; err != nil { return err } n . unmarshaling = false return nil }
UnmarshalJSON implements the json.Unmarshaler interface for the Note type.
UnmarshalJSON implements the json . Unmarshaler interface for the Note type .