// UnmarshalJSON interpets input as either a Device or a device name (backwards-compatibility)
UnmarshalJSON interpets input as either a Device or a device name (backwards-compatibility)
// UnmarshalJSON interpets input as either a Device or a device name ( backwards - compatibility )
func (r *Device) UnmarshalJSON(p []byte) error {
	type serializableDevice Device
	var device serializableDevice
	if err := json.Unmarshal(p, &device); err != nil {
		return json.Unmarshal(p, &r.Name)
	}
	*r = Device(device)
	return nil
}
func ( r * Device ) UnmarshalJSON ( p [ ] byte ) error { type serializableDevice Device var device serializableDevice if err := json . Unmarshal ( p , & device ) ; err != nil { return json . Unmarshal ( p , & r . Name ) } * r = Device ( device ) return nil }
UnmarshalJSON interpets input as either a Device or a device name (backwards-compatibility)
UnmarshalJSON interpets input as either a Device or a device name ( backwards - compatibility )
// Backwards compatibility - parse as a device name