// unmarshal unmarshals a JSON object from the response object's body. If the
// Content-Type is not application/json or application/vnd* (or we can't detect
// the media type) an error is returned. The response body is always closed.
553360
func unmarshal(resp *http.Response, v interface{}) error {
	defer resp.Body.Close()

	// Don't Unmarshal Body if v is nil
	if v == nil {
		return nil
	}

	ctype, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
	if err != nil {
		return err
	}

	if !isJSONContentType(ctype) {
		return fmt.Errorf("unexpected response: %s %s", resp.Status, ctype)
	}

	return json.NewDecoder(resp.Body).Decode(v)
}
578831
func (StdJSON) Unmarshal(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
198317
func (n *Node) Unmarshal(data []byte) error {
	newNode := Node{}
	if err := json.Unmarshal(data, &newNode); err != nil {
		return err
	}

	*n = newNode

	return nil
}
809969
func Unmarshal(b []byte) (orb.Geometry, error) {
	g, err := NewDecoder(bytes.NewReader(b)).Decode()
	if err == io.EOF || err == io.ErrUnexpectedEOF {
		return nil, ErrNotWKB
	}

	return g, err
}
134716
func (bm *BlockMeta) Unmarshal(bs []byte) error {
	return cdc.UnmarshalBinaryBare(bs, bm)
}
913855
func Unmarshal(data []byte, target interface{}) error {
	if target == nil {
		return errors.New("target must not be nil")
	}

	if reflect.TypeOf(target).Kind() != reflect.Ptr {
		return errors.New("target must be a ptr")
	}

	ctx := &Document{}

	err := json.Unmarshal(data, ctx)
	if err != nil {
		return err
	}

	if ctx.Data == nil {
		return errors.New(`Source JSON is empty and has no "attributes" payload object`)
	}

	if ctx.Data.DataObject != nil {
		return setDataIntoTarget(ctx.Data.DataObject, target)
	}

	if ctx.Data.DataArray != nil {
		targetSlice := reflect.TypeOf(target).Elem()
		if targetSlice.Kind() != reflect.Slice {
			return fmt.Errorf("Cannot unmarshal array to struct target %s", targetSlice)
		}
		targetType := targetSlice.Elem()
		targetPointer := reflect.ValueOf(target)
		targetValue := targetPointer.Elem()

		for _, record := range ctx.Data.DataArray {
			// check if there already is an entry with the same id in target slice,
			// otherwise create a new target and append
			var targetRecord, emptyValue reflect.Value
			for i := 0; i < targetValue.Len(); i++ {
				marshalCasted, ok := targetValue.Index(i).Interface().(MarshalIdentifier)
				if !ok {
					return errors.New("existing structs must implement interface MarshalIdentifier")
				}
				if record.ID == marshalCasted.GetID() {
					targetRecord = targetValue.Index(i).Addr()
					break
				}
			}

			if targetRecord == emptyValue || targetRecord.IsNil() {
				targetRecord = reflect.New(targetType)
				err := setDataIntoTarget(&record, targetRecord.Interface())
				if err != nil {
					return err
				}
				targetValue = reflect.Append(targetValue, targetRecord.Elem())
			} else {
				err := setDataIntoTarget(&record, targetRecord.Interface())
				if err != nil {
					return err
				}
			}
		}

		targetPointer.Elem().Set(targetValue)
	}

	return nil
}
932963
func (j *JSONMarshaler) Unmarshal(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
1012239
func (l *ElasticsearchDomainEBSOptionsList) UnmarshalJSON(buf []byte) error {
	// Cloudformation allows a single object when a list of objects is expected
	item := ElasticsearchDomainEBSOptions{}
	if err := json.Unmarshal(buf, &item); err == nil {
		*l = ElasticsearchDomainEBSOptionsList{item}
		return nil
	}
	list := []ElasticsearchDomainEBSOptions{}
	err := json.Unmarshal(buf, &list)
	if err == nil {
		*l = ElasticsearchDomainEBSOptionsList(list)
		return nil
	}
	return err
}
880871
func (datr *DataRate) Unmarshal(data []byte) error {
	*datr = DataRate{} // Reset the receiver
	return datr.UnmarshalBinary(data)
}
113238
func Unmarshal(data url.Values, v interface{}) error {
	var d decoder
	d.init(data)
	return d.unmarshal(v)
}
448348
func Unmarshal(data []byte, v interface{}) (err error) {
	var value interface{}
	parser := &hjsonParser{data, 0, ' '}
	parser.resetAt()
	value, err = parser.rootValue()
	if err != nil {
		return err
	}

	rv := reflect.ValueOf(v)
	if rv.Kind() != reflect.Ptr || rv.IsNil() {
		return errors.New("non-pointer " + reflect.TypeOf(v).String())
	}
	for rv.Kind() == reflect.Ptr {
		rv = rv.Elem()
	}
	defer func() {
		if e := recover(); e != nil {
			err = fmt.Errorf("%v", e)
		}
	}()
	rv.Set(reflect.ValueOf(value))
	return err
}
825117
func (eui *AppEUI) Unmarshal(data []byte) error {
	*eui = [8]byte{} // Reset the receiver
	return eui.UnmarshalBinary(data)
}
148233
func (BitCurve *BitCurve) Unmarshal(data []byte) (x, y *big.Int) {
	byteLen := (BitCurve.BitSize + 7) >> 3
	if len(data) != 1+2*byteLen {
		return
	}
	if data[0] != 4 { // uncompressed form
		return
	}
	x = new(big.Int).SetBytes(data[1 : 1+byteLen])
	y = new(big.Int).SetBytes(data[1+byteLen:])
	return
}
1317912
func (l *CloudFrontDistributionCustomErrorResponseList) UnmarshalJSON(buf []byte) error {
	// Cloudformation allows a single object when a list of objects is expected
	item := CloudFrontDistributionCustomErrorResponse{}
	if err := json.Unmarshal(buf, &item); err == nil {
		*l = CloudFrontDistributionCustomErrorResponseList{item}
		return nil
	}
	list := []CloudFrontDistributionCustomErrorResponse{}
	err := json.Unmarshal(buf, &list)
	if err == nil {
		*l = CloudFrontDistributionCustomErrorResponseList(list)
		return nil
	}
	return err
}
1370378
func (s *Serializer) Unmarshal(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
153533
func (n *DevNonce) Unmarshal(data []byte) error {
	*n = [2]byte{} // Reset the receiver
	return n.UnmarshalBinary(data)
}
170874
func (l *APIGatewayMethodMethodResponseList) UnmarshalJSON(buf []byte) error {
	// Cloudformation allows a single object when a list of objects is expected
	item := APIGatewayMethodMethodResponse{}
	if err := json.Unmarshal(buf, &item); err == nil {
		*l = APIGatewayMethodMethodResponseList{item}
		return nil
	}
	list := []APIGatewayMethodMethodResponse{}
	err := json.Unmarshal(buf, &list)
	if err == nil {
		*l = APIGatewayMethodMethodResponseList(list)
		return nil
	}
	return err
}