summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/Philipp15b/go-steam/jsont/jsont.go
blob: 0927f983369c0b563c889cbdefb105d86211f689 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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
}