mohae/joefriday · version_unix.go
go logo
func Deserialize(p []byte) (*v.Kernel, error) {
	k := &v.Kernel{}
	err := json.Unmarshal(p, k)
	if err != nil {
		return nil, err
	}
	return k, nil
}
Similar code snippets
1.
juju/juju · service.go
Match rating: 55.09% · See similar code snippets
go logo
func (s *Service) deserialize(data []byte) (common.Conf, error) {
	conf, err := deserialize(data, renderer)
	if err != nil {
		return conf, s.errorf(err, "failed to deserialize conf")
	}
	return conf, nil
}
2.
mohae/joefriday · os_unix.go
Match rating: 54.85% · See similar code snippets
go logo
func Deserialize(p []byte) (*o.OS, error) {
	os := &o.OS{}
	err := json.Unmarshal(p, os)
	if err != nil {
		return nil, err
	}
	return os, nil
}
3.
boj/redistore · redistore.go
Match rating: 54.04% · See similar code snippets
go logo
func (s JSONSerializer) Deserialize(d []byte, ss *sessions.Session) error {
	m := make(map[string]interface{})
	err := json.Unmarshal(d, &m)
	if err != nil {
		fmt.Printf("redistore.JSONSerializer.deserialize() Error: %v", err)
		return err
	}
	for k, v := range m {
		ss.Values[k] = v
	}
	return nil
}
4.
mohae/joefriday · loadavg_unix.go
Match rating: 53.03% · See similar code snippets
go logo
func Deserialize(p []byte) (la l.LoadAvg, err error) {
	err = json.Unmarshal(p, &la)
	if err != nil {
		return la, err
	}
	return la, nil
}
5.
mohae/joefriday · diskstats_unix.go
Match rating: 52.68% · See similar code snippets
go logo
func Deserialize(p []byte) (*structs.DiskStats, error) {
	st := &structs.DiskStats{}
	err := json.Unmarshal(p, st)
	if err != nil {
		return nil, err
	}
	return st, nil
}
6.
sclasen/swfsm · fsm_models.go
Match rating: 51.55% · See similar code snippets
go logo
func (j JSONStateSerializer) Deserialize(serialized string, state interface{}) error {
	err := json.NewDecoder(strings.NewReader(serialized)).Decode(state)
	return err
}
7.
mohae/joefriday · cpustats_unix.go
Match rating: 50.97% · See similar code snippets
go logo
func Deserialize(p []byte) (*stats.CPUStats, error) {
	st := &stats.CPUStats{}
	err := json.Unmarshal(p, st)
	if err != nil {
		return nil, err
	}
	return st, nil
}
8.
mohae/joefriday · uptime_unix.go
Match rating: 50.07% · See similar code snippets
go logo
func Deserialize(p []byte) (*up.Uptime, error) {
	var u up.Uptime
	err := json.Unmarshal(p, &u)
	if err != nil {
		return nil, err
	}
	return &u, nil
}
9.
portworx/kvdb · kv_etcd.go
Match rating: 49.15% · See similar code snippets
go logo
func (et *etcdKV) Deserialize(b []byte) (kvdb.KVPairs, error) {
	return et.DeserializeAll(b)
}
10.
lavab/api · messages.go
Match rating: 49.02% · See similar code snippets
go logo
func Decode(x []string, r interface{}) error {
	var v *Response
	if err := json.Unmarshal([]byte(x[0]), &v); err != nil {
		return err
	}
	if err := json.Unmarshal([]byte(v.Body), &r); err != nil {
		return err
	}

	return nil
}