// Decode into a ma[string]interface{} the JSON in the POST Request
166703
func DecodePostJSON(request *http.Request, logging bool) (map[string]interface{}, error) {
	var err error
	var payLoad map[string]interface{}
	if logging {
		reader := reader_shadow_copy.New(request.Body)
		decoder := json.NewDecoder(reader)
		err = decoder.Decode(&payLoad)
		glog.V(4).Infof("body: %s", string(reader.Bytes()))
		return payLoad, err
	}
	decoder := json.NewDecoder(request.Body)
	err = decoder.Decode(&payLoad)
	return payLoad, err
}
55957
func Decode(out interface{}, in string) error {
	obj, err := Parse(in)
	if err != nil {
		return err
	}

	return DecodeObject(out, obj)
}
95594
func (f *CustomUplinkFunctions) Decode(payload []byte, port uint8) (map[string]interface{}, bool, error) {
	decoded, err := f.decode(payload, port)
	if err != nil {
		return nil, false, err
	}

	converted, err := f.convert(decoded, port)
	if err != nil {
		return nil, false, err
	}

	valid, err := f.validate(converted, port)
	return converted, valid, err
}
267308
func Decode(data []byte) (*Message, error) {
	if len(data) < msgHeadLength {
		return nil, ErrInvalidMessage
	}
	m := New()
	flag := data[0]
	offset := 1
	m.Type = Type((flag >> 1) & msgTypeMask)

	if invalidType(m.Type) {
		return nil, ErrWrongMessageType
	}

	if m.Type == Request || m.Type == Response {
		id := uint(0)
		// little end byte order
		// WARNING: must can be stored in 64 bits integer
		// variant length encode
		for i := offset; i < len(data); i++ {
			b := data[i]
			id += uint(b&0x7F) << uint(7*(i-offset))
			if b < 128 {
				offset = i + 1
				break
			}
		}
		m.ID = id
	}

	m.Err = flag&errorMask == errorMask

	if routable(m.Type) {
		if flag&msgRouteCompressMask == 1 {
			m.compressed = true
			code := binary.BigEndian.Uint16(data[offset:(offset + 2)])
			route, ok := codes[code]
			if !ok {
				return nil, ErrRouteInfoNotFound
			}
			m.Route = route
			offset += 2
		} else {
			m.compressed = false
			rl := data[offset]
			offset++
			m.Route = string(data[offset:(offset + int(rl))])
			offset += int(rl)
		}
	}

	m.Data = data[offset:]
	var err error
	if flag&gzipMask == gzipMask {
		m.Data, err = compression.InflateData(m.Data)
		if err != nil {
			return nil, err
		}
	}
	return m, nil
}
433866
func Decode(input interface{}, output interface{}) error {
	config := &DecoderConfig{
		Metadata: nil,
		Result:   output,
	}

	decoder, err := NewDecoder(config)
	if err != nil {
		return err
	}

	return decoder.Decode(input)
}
169163
func (res *Response) Decode(r io.Reader) error {
	var buf [16]byte
	_, err := io.ReadFull(r, buf[0:16])
	if err != nil {
		return errors.Trace(err)
	}

	res.Physical = int64(binary.BigEndian.Uint64(buf[0:8]))
	res.Logical = int64(binary.BigEndian.Uint64(buf[8:16]))
	return nil
}
1352661
func Decode(data []byte) (*ServicesState, error) {
	newState := NewServicesState()
	err := newState.UnmarshalJSON(data)
	if err != nil {
		log.Errorf("Error decoding state! (%s)", err.Error())
	}

	return newState, err
}
102123
func (d *YAMLToJSONDecoder) Decode(into interface{}) error {
	bytes, err := d.reader.Read()
	if err != nil && err != io.EOF {
		return err
	}

	if len(bytes) != 0 {
		err := yaml.Unmarshal(bytes, into)
		if err != nil {
			return YAMLSyntaxError{err}
		}
	}
	return err
}
682759
func (decoder *Decoder) Decode(v interface{}) error {
	node, err := Read(decoder.r, decoder.opt.clone)
	if err != nil {
		return err
	}
	var buf bytes.Buffer
	if err := Write(&buf, node); err != nil {
		return err
	}
	return json.Unmarshal(buf.Bytes(), v)
}
173231
func (e MsgPakEncoderDecoder) Decode(buf []byte, out interface{}) error {
	reader := bytes.NewReader(buf)
	handle := codec.MsgpackHandle{}
	decoder := codec.NewDecoder(reader, &handle)
	return decoder.Decode(out)
}
1309879
func (m *Unmarshaller) Decode(r io.Reader, obj interface{}) error {
	m.reader.r = r
	err := m.unmarshal.Unmarshal(obj)
	m.reader.r = nil
	return err
}
881337
func (d *Decoder) Decode(v interface{}) error {
	var err error
	d.tval, err = LoadReader(d.r)
	if err != nil {
		return err
	}
	return d.unmarshal(v)
}
1347164
func (resp *HttpResponse) JsonDecode(out interface{}, strict bool) error {
	dec := json.NewDecoder(resp.Body)
	if strict {
		dec.DisallowUnknownFields()
	}
	defer resp.Body.Close()
	return dec.Decode(out)
}
1299016
func (r *Response) DecodeJSON(out interface{}) error {
	return jsonutil.DecodeJSONFromReader(r.Body, out)
}
1059654
func DecodeRequest(r *http.Request, v interface{}, ignoreEOF bool) error {
	if err := json.NewDecoder(r.Body).Decode(v); err != nil {
		if err == io.EOF && ignoreEOF {
			return nil
		}
		return fmt.Errorf("error decoding request body: %v", err)
	}
	return nil
}
1156451
func (req *RequestVoteRequest) Decode(r io.Reader) (int, error) {
	data, err := ioutil.ReadAll(r)

	if err != nil {
		return -1, err
	}

	totalBytes := len(data)

	pb := &protobuf.RequestVoteRequest{}
	if err = proto.Unmarshal(data, pb); err != nil {
		return -1, err
	}

	req.Term = pb.GetTerm()
	req.LastLogIndex = pb.GetLastLogIndex()
	req.LastLogTerm = pb.GetLastLogTerm()
	req.CandidateName = pb.GetCandidateName()

	return totalBytes, nil
}
1084435
func (mock *Mock) Decode(data []byte) ([]*FileDataEntry, error) {
	items := mock.getReturnValues("Decode")
	if len(items) == 1 {
		switch typed := items[0].(type) {
		case []*FileDataEntry:
			return typed, nil
		case error:
			return []*FileDataEntry{}, typed
		}
	} else if len(items) == 2 {
		return items[0].([]*FileDataEntry), items[1].(error)
	}
	return []*FileDataEntry{}, nil
}