mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-19 09:32:35 +01:00
20 lines
341 B
Go
20 lines
341 B
Go
// Includes helper types for working with JSON data
|
|
package jsont
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
// A boolean value that can be unmarshaled from a number in JSON.
|
|
type UintBool bool
|
|
|
|
func (u *UintBool) UnmarshalJSON(data []byte) error {
|
|
var n uint
|
|
err := json.Unmarshal(data, &n)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
*u = n != 0
|
|
return nil
|
|
}
|