// UnmarshalJSON is written because it has a value(time) in a special format.
UnmarshalJSON is written because it has a value(time) in a special format.
// UnmarshalJSON is written because it has a value ( time ) in a special format .
func (e *Event) UnmarshalJSON(b []byte) error {
	var rawStrings map[string]string
	err := json.Unmarshal(b, &rawStrings)
	if err != nil {
		return errors.Wrapf(err, "Failed UnMarshalling object b: %v", b)
	}
	for k, v := range rawStrings {
		switch strings.ToLower(k) {
		case "time":
			eastLoc, err := time.LoadLocation(LastPassTimeZone)
			if err != nil {
				return err
			}
			t, err := time.ParseInLocation(LastPassFormat, v, eastLoc)
			if err != nil {
				return err
			}
			e.Time = t.UTC()
		case "username":
			e.Username = v
		case "ip_address":
			e.IPAddress = v
		case "action":
			e.Action = v
		case "data":
			e.Data = v
		case "id":
			e.ID = v
		}
	}
	return nil
}
func ( e * Event ) UnmarshalJSON ( b [ ] byte ) error { var rawStrings map [ string ] string err := json . Unmarshal ( b , & rawStrings ) if err != nil { return errors . Wrapf ( err , " " , b ) } for k , v := range rawStrings { switch strings . ToLower ( k ) { case " " : eastLoc , err := time . LoadLocation ( LastPassTimeZone ) if err != nil { return err } t , err := time . ParseInLocation ( LastPassFormat , v , eastLoc ) if err != nil { return err } e . Time = t . UTC ( ) case " " : e . Username = v case " " : e . IPAddress = v case " " : e . Action = v case " " : e . Data = v case " " : e . ID = v } } return nil }
UnmarshalJSON is written because it has a value(time) in a special format.
UnmarshalJSON is written because it has a value ( time ) in a special format .