typed.go
func (t Typed) ToBytes(key string) ([]byte, error) {
	var o interface{}
	if len(key) == 0 {
		o = t
	} else {
		exists := false
		o, exists = t[key]
		if exists == false {
			return nil, KeyNotFound
		}
	}
	if o == nil {
		return nil, nil
	}
	data, err := json.Marshal(o)
	if err != nil {
		return nil, err
	}
	return data, nil
}
func (t Typed) ToBytes(key string) ([]byte, error) {
	var o interface{}
	if len(key) == 0 {
		o = t
	} else {
		exists := false
		o, exists = t[key]
		if exists == false {
			return nil, KeyNotFound
		}
	}
	if o == nil {
		return nil, nil
	}
	data, err := json.Marshal(o)
	if err != nil {
		return nil, err
	}
	return data, nil
}
func ( t Typed ) ToBytes ( key string ) ( [ ] byte , error ) { var o interface { } if len ( key ) == 0 { o = t } else { exists := false o , exists = t [ key ] if exists == false { return nil , KeyNotFound } } if o == nil { return nil , nil } data , err := json . Marshal ( o ) if err != nil { return nil , err } return data , nil }
// Marhals the type into a []byte.
// If key isn't valid, KeyNotFound is returned.
// If the typed doesn't represent valid JSON, a relevant
// JSON error is returned
Marhals the type into a [] byte . If key isn t valid KeyNotFound is returned . If the typed doesn t represent valid JSON a relevant JSON error is returned