sclasen/swfsm · fsm_models.go
go logo
func (j JSONStateSerializer) Deserialize(serialized string, state interface{}) error {
	err := json.NewDecoder(strings.NewReader(serialized)).Decode(state)
	return err
}
Similar code snippets
1.
sclasen/swfsm · jsonpbserializer.go
Match rating: 77.74% · See similar code snippets
go logo
func (j JSONPBStateSerializer) Deserialize(serialized string, state interface{}) error {
	pm, ok := state.(proto.Message)
	if ok {
		return j.u.Unmarshal(strings.NewReader(serialized), pm)
	}
	return j.fbss.Deserialize(serialized, state)
}
2.
gorilla/securecookie · securecookie.go
Match rating: 57.8% · See similar code snippets
go logo
func (e JSONEncoder) Deserialize(src []byte, dst interface{}) error {
	dec := json.NewDecoder(bytes.NewReader(src))
	if err := dec.Decode(dst); err != nil {
		return cookieError{cause: err, typ: decodeError}
	}
	return nil
}
3.
mohae/joefriday · diskstats_unix.go
Match rating: 52.2% · 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
}
4.
grpc-ecosystem/grpc-gateway · marshal_jsonpb.go
Match rating: 51.9% · See similar code snippets
go logo
func unmarshalJSONPb(data []byte, v interface{}) error {
	d := json.NewDecoder(bytes.NewReader(data))
	return decodeJSONPb(d, v)
}
5.
mohae/joefriday · cpuutil_unix.go
Match rating: 51.43% · See similar code snippets
go logo
func Deserialize(p []byte) (*util.CPUUtil, error) {
	ut := &util.CPUUtil{}
	err := json.Unmarshal(p, ut)
	if err != nil {
		return nil, err
	}
	return ut, nil
}
6.
apcera/libretto · util.go
Match rating: 51.28% · See similar code snippets
go logo
func parseAccountJSON(result interface{}, jsonText string) error {
	dec := json.NewDecoder(strings.NewReader(jsonText))
	return dec.Decode(result)
}
7.
control-center/serviced · datastore.go
Match rating: 51.1% · See similar code snippets
go logo
func (ds *DataStore) deserialize(kind string, jsonMsg JSONMessage, entity ValidEntity) error {
	// hook for looking up deserializers by kind; default json Unmarshal for now
	if err := SafeUnmarshal(jsonMsg.Bytes(), entity); err != nil {
		return err
	}
	entity.SetDatabaseVersion(jsonMsg.Version())
	return nil
}
8.
mohae/joefriday · mem_unix.go
Match rating: 50.29% · See similar code snippets
go logo
func Deserialize(p []byte) (*m.MemInfo, error) {
	var inf m.MemInfo
	err := json.Unmarshal(p, &inf)
	if err != nil {
		return nil, err
	}
	return &inf, nil
}
9.
hashicorp/packer · account.go
Match rating: 50.1% · See similar code snippets
go logo
func parseJSON(result interface{}, text string) error {
	r := strings.NewReader(text)
	dec := json.NewDecoder(r)
	return dec.Decode(result)
}
10.
CodisLabs/codis · encode.go
Match rating: 50.05% · See similar code snippets
go logo
func jsonDecode(v interface{}, b []byte) error {
	if err := json.Unmarshal(b, v); err != nil {
		return errors.Trace(err)
	}
	return nil
}