// Marshal non-JSON object to JSON string.
979845
func (b *PeopleJSONBuilder) Marshal(orig *People) ([]byte, error) {
	ret, err := b.Convert(orig)
	if err != nil {
		return nil, err
	}
	return json.Marshal(ret)
}
1165777
func Marshal(g geom.T) ([]byte, error) {
	geojson, err := Encode(g)
	if err != nil {
		return nil, err
	}
	return json.Marshal(geojson)
}
421171
func (address *Address) Marshal() ([]byte, error) {
	if address == nil {
		return nil, nil
	}
	return address.Bytes(), nil
}
613819
func (m *Marshaller) Marshal(obj interface{}) ([]byte, error) {
	var buf bytes.Buffer
	if err := m.Encode(obj, &buf); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
1015219
func (sp *SerializerProto) Marshal(message proto.Message) ([]byte, error) {
	return proto.Marshal(message)
}
395048
func Marshal(v interface{}) ([]byte, error) {
	if ImplementsPreJSONMarshaler(v) {
		err := v.(PreJSONMarshaler).PreMarshalJSON()
		if err != nil {
			return nil, err
		}
	}

	return json.Marshal(v)
}
1219856
func (m *Time) Marshal() (data []byte, err error) {
	if m == nil || m.Time.IsZero() {
		return nil, nil
	}
	return m.ProtoTime().Marshal()
}
1024977
func (prof *Profiler) Marshal(ut *util.CPUUtil) ([]byte, error) {
	return prof.Serialize(ut)
}
770568
func Marshal(v interface{}) ([]byte, error) {
	if u, ok := v.(Marshaler); ok {
		return u.MarshalURL()
	}

	rv := reflect.ValueOf(v)
	if rv == zeroval {
		return nil, errors.New("can not unmarshal into a nil value")
	}

	// This better be a pointer
	switch rv.Kind() {
	case reflect.Ptr, reflect.Interface:
		// Get the value beyond the pointer
		rv = rv.Elem()
	}

	switch rv.Kind() {
	case reflect.Map:
		if kk := rv.Type().Key().Kind(); kk != reflect.String {
			return nil, errors.New("urlenc.Marshal: map key must be string type (Kind: " + kk.String() + ")")
		}
		return marshalMap(rv)
	case reflect.Struct:
		return marshalStruct(rv)
	default:
		return nil, errors.New("urlenc.Marshal: unsupported type (" + rv.Type().String() + ")")
	}
}
1186343
func (l *LockInfo) Marshal() []byte {
	js, err := json.Marshal(l)
	if err != nil {
		panic(err)
	}
	return js
}
1093980
func (sj *SerializerJSON) Marshal(message proto.Message) ([]byte, error) {
	if message == nil {
		return []byte("null"), nil
	}
	var buf bytes.Buffer
	if err := DefaultMarshaler.Marshal(&buf, message); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
1226948
func (b *Builder) Marshal(w io.Writer) error {
	var nodeType lowring.Node
	j := &builderJSON{
		MarshalVersion:              0,
		NodeType:                    int(unsafe.Sizeof(nodeType)) * 8,
		ReplicaCount:                len(b.ring.ReplicaToPartitionToNode),
		PartitionCount:              len(b.ring.ReplicaToPartitionToNode[0]),
		Nodes:                       make([]*builderNodeJSON, len(b.nodes)),
		Groups:                      make([]*builderGroupJSON, len(b.groups)),
		MaxPartitionCount:           b.ring.MaxPartitionCount,
		Rebalanced:                  b.ring.Rebalanced.UnixNano(),
		ReassignmentWait:            int(b.ring.ReassignmentWait),
		MaxReplicaReassignableCount: int(b.ring.MaxReplicaReassignableCount),
	}
	for i, n := range b.nodes {
		j.Nodes[i] = &builderNodeJSON{
			Info:     n.info,
			Capacity: b.ring.NodeToCapacity[n.index],
			Group:    b.ring.NodeToGroup[n.index],
		}
	}
	for i, g := range b.groups {
		j.Groups[i] = &builderGroupJSON{
			Info:   g.info,
			Parent: b.ring.GroupToGroup[g.index],
		}
	}
	if err := json.NewEncoder(w).Encode(j); err != nil {
		return err
	}
	// This 0 byte is written as a preface to the raw ring data and will let
	// the unmarshaler get past any trailing whitespace, newlines, etc. that
	// the JSON encoder may or may not have written.
	if _, err := w.Write([]byte{0}); err != nil {
		return err
	}
	for _, partitionToNode := range b.ring.ReplicaToPartitionToNode {
		if err := binary.Write(w, binary.LittleEndian, partitionToNode); err != nil {
			return err
		}
	}
	for _, partitionToWait := range b.ring.ReplicaToPartitionToWait {
		if err := binary.Write(w, binary.LittleEndian, partitionToWait); err != nil {
			return err
		}
	}
	return nil
}
166316
func (m *MockSerializer) Marshal(arg0 interface{}) ([]byte, error) {
	ret := m.ctrl.Call(m, "Marshal", arg0)
	ret0, _ := ret[0].([]byte)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1309076
func marshal(i interface{}) (string, []byte, error) {
	if _, ok := i.(proto.Message); ok {
		data, err := marshalPB(i)
		return contentTypePB, data, err
	}
	data, err := json.Marshal(i)
	return contentTypeJSON, data, err
}
84419
func Marshal(pb Message) ([]byte, error) {
	// Can the object marshal itself?
	if m, ok := pb.(Marshaler); ok {
		return m.Marshal()
	}
	p := NewBuffer(nil)
	err := p.Marshal(pb)
	var state errorState
	if err != nil && !state.shouldContinue(err, nil) {
		return nil, err
	}
	if p.buf == nil && err == nil {
		// Return a non-nil slice on success.
		return []byte{}, nil
	}
	return p.buf, err
}
416035
func (j *JSONPb) Marshal(v interface{}) ([]byte, error) {
	if _, ok := v.(proto.Message); !ok {
		return j.marshalNonProtoField(v)
	}
	var buf bytes.Buffer
	if err := j.marshalTo(&buf, v); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
520850
func Marshal(v interface{}) ([]byte, error) {
	if command, sep, err := generateCommand(v, true); err == nil {
		return []byte(strings.Join(command, sep)), nil
	} else {
		return nil, err
	}
}