// DecodeObject is the same as Decode but it returns map[string]interface{}.
// You should use it to parse JSON objects.
10206
func DecodeObject(data []byte) (map[string]interface{}, error) {
	d := NewDecoder(data)
	if c := d.skipSpaces(); c != '{' {
		return nil, d.error(c, "looking for beginning of object")
	}
	val, err := d.object()
	if err != nil {
		return nil, err
	}
	if c := d.skipSpaces(); d.pos < d.end {
		return nil, d.error(c, "after top-level value")
	}
	return val, nil
}
236761
func (dec *Decoder) Decode(v interface{}) error {
	data, err := dec.Reader.Read()
	if err != nil {
		return err
	}
	return json.Unmarshal(data, v)
}
1267732
func Decode(d Decoder, data []byte) (Object, error) {
	return d.Decode(data)
}
515628
func (p *parser) parseObj() (string, objType, string) {
	p.skipWhitespace()
	c := p.c()
	if c[0] == '"' || c[0] == '\'' {
		i := 1
	For:
		for ; i < len(c); i++ {
			switch c[i] {
			case '\\':
				i++
			case c[0]:
				break For
			}
		}
		p.i += i + 1

		s := "\"" + string(c[1:i]) + "\""
		json.Unmarshal([]byte(s), &s)
		lang := ""
		if c[i+1] == '@' {
			c = p.c()
			i := bytes.IndexAny(c, stopRunes)
			if c[i-1] == '.' {
				i--
			}
			p.i += i
			lang = string(c[1:i])
		} else if bytes.Equal(c[i+1:i+3], []byte("^^")) {
			// TODO(d4l3k): Implement RDF types.
		}
		return s, typeString, lang
	} else if bytes.HasPrefix(c, []byte("<")) {
		i := bytes.IndexRune(c, '>')
		p.i += i + 1
		url := string(c[1:i])
		if !strings.Contains(url, "://") {
			url = p.base + url
		}
		return url, typeIRI, ""
	} else if bytes.HasPrefix(c, []byte(".")) {
		p.i += 1
		return ".", typeEnd, ""
	} else if bytes.HasPrefix(c, []byte(";")) {
		p.i += 1
		return ";", typePred, ""
	} else if bytes.HasPrefix(c, []byte(",")) {
		p.i += 1
		return ",", typeObj, ""
	} else {
		i := bytes.IndexAny(c, stopRunes)
		if c[i-1] == '.' {
			i--
		}
		p.i += i
		obj := string(c[:i])
		psym := strings.IndexRune(obj, ':')
		if psym != -1 {
			if psym == len(obj)-1 {
				return obj, typePrefix, ""
			}
			prefix := obj[:psym+1]
			if expand, ok := p.prefix[prefix]; ok {
				return expand + obj[psym+1:], typeIRI, ""
			}
		}
		return obj, typeUnknown, ""
	}
}
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)
}
12628
func (self *JsonDecoder) Decode(body []byte, wireType interface{}) error {
	err := json.Unmarshal(body, wireType)
	return err
}
251202
func Decode(in string) ([]byte, error) {
	out, err := Client().Decode(in)
	Trace("Decode", err, logrus.Fields{"in": in, "out": out})
	return out, err
}
1343310
func DecodeObjectToStr(in []byte) string {
	if binaryFmt(in) {
		var b bytes.Buffer
		cbor2JsonOneObject(getReader(string(in)), &b)
		return b.String()
	}
	return string(in)
}
1237510
func (m AttributeMap) Decode(dst interface{}, opts ...mapdecode.Option) error {
	return DecodeInto(dst, m, opts...)
}
132841
func (decoder StringDecoder) Decode(in *goetty.ByteBuf) (bool, interface{}, error) {
	_, data, err := in.ReadMarkedBytes()

	if err != nil {
		return true, "", err
	}

	return true, string(data), nil
}
1319591
func Decode(in string) ([]byte, error) {
	o, err := b64.StdEncoding.DecodeString(in)
	if err != nil {
		// maybe it's in the URL variant?
		o, err = b64.URLEncoding.DecodeString(in)
		if err != nil {
			// ok, just give up...
			return nil, err
		}
	}
	return o, nil
}
919503
func (c *DecryptionClient) GetObject(input *s3.GetObjectInput) (*s3.GetObjectOutput, error) {
	req, out := c.GetObjectRequest(input)
	return out, req.Send()
}
1344051
func (args *QueueBindingArgs) Decode(value string) error {
	pairs := strings.Split(value, ",")
	mp := make(map[string]interface{}, len(pairs))
	for _, pair := range pairs {
		kvpair := strings.Split(pair, ":")
		if len(kvpair) != 2 {
			return fmt.Errorf("invalid map item: %q", pair)
		}
		mp[kvpair[0]] = kvpair[1]
	}
	*args = QueueBindingArgs(mp)
	return nil
}
301713
func decodeJSON(out interface{}, body io.ReadCloser) error {
	defer body.Close()

	var parsed interface{}
	dec := json.NewDecoder(body)
	if err := dec.Decode(&parsed); err != nil {
		return err
	}

	decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
		DecodeHook: mapstructure.ComposeDecodeHookFunc(
			mapToHTTPHeaderHookFunc(),
			stringToTimeHookFunc(),
		),
		WeaklyTypedInput: true,
		Result:           out,
	})
	if err != nil {
		return err
	}
	return decoder.Decode(parsed)
}
472149
func Decode(data []byte) (result interface{}, err error) {
	result, _, err = decodeItem(data, 0)
	return
}
1124181
func (d *Decoder) DecodeArray() ([]interface{}, error) {
	if c := d.skipSpaces(); c != '[' {
		return nil, d.error(c, "looking for beginning of array")
	}
	val, err := d.array()
	if err != nil {
		return nil, err
	}
	if c := d.skipSpaces(); d.pos < d.end {
		return nil, d.error(c, "after top-level value")
	}
	return val, nil
}
1039328
func decodeInterface(ctx context.Context, encoding string, b []byte, o interface{}) {
	switch encoding {
	case "json":
		decodeJsonInterface(ctx, b, o)
	default:
		panic(fmt.Sprintf("Unknown encoding %s", encoding))
	}
}