// NewJSONDecoder returns a new decoder that reads from r.
//
// This function is intended to be used in place of the standard json.NewDecoder
// when json.Number is required.
15526
func NewJSONDecoder(r io.Reader) *json.Decoder {
	decoder := json.NewDecoder(r)
	decoder.UseNumber()
	return decoder
}
925321
func NewFromReader(r io.Reader) (*Json, error) {
	j := new(Json)
	dec := json.NewDecoder(r)
	dec.UseNumber()
	err := dec.Decode(&j.data)
	return j, err
}
279494
func (c *Client) ReadJSON(v interface{}) (err error) {
	_, r, err := c.NextReader()
	if err != nil {
		return err
	}
	return codec.NewDecoder(r, &jh).Decode(v)
}
992334
func NewJSONEncoder(w io.Writer, bo binary.ByteOrder) JSONEncoder {
	return &jsonEncoder{
		w:  w,
		bo: bo,
	}
}
417521
func decoder(resp *http.Response) *json.Decoder {
	return json.NewDecoder(resp.Body)
}
102298
func NewReader(r io.Reader) *Reader {
	return &Reader{
		r:       r,
		decoded: make([]byte, maxBlockSize),
		buf:     make([]byte, maxEncodedLenOfMaxBlockSize+checksumSize),
	}
}
299137
func NewFromReader(r io.Reader) storage.Store {
	d := util.NewJSONDecoder(r)
	var data map[string]interface{}
	if err := d.Decode(&data); err != nil {
		panic(err)
	}
	return NewFromObject(data)
}
135360
func NewDecoderBytes(in []byte, h Handle) *Decoder {
	d := newDecoder(h)
	d.ResetBytes(in)
	return d
}
709590
func NewJson(body []byte) (*Json, error) {
	j := new(Json)
	err := j.UnmarshalJSON(body)
	if err != nil {
		return nil, err
	}
	return j, nil
}
1005189
func (d *YAMLToJSONDecoder) Decode(into interface{}) error {
	if d.scanner.Scan() {
		data, err := yaml.YAMLToJSON(d.scanner.Bytes())
		if err != nil {
			return err
		}
		return json.Unmarshal(data, into)
	}
	err := d.scanner.Err()
	if err == nil {
		err = io.EOF
	}
	return err
}
657755
func (j *GoGoJSONPb) NewDecoder(r io.Reader) Decoder {
	d := json.NewDecoder(r)
	return DecoderFunc(func(v interface{}) error { return decodeGoGoJSONPb(d, v) })
}
659920
func NewDecoder(r io.Reader, format Format) Decoder {
	switch format {
	case FmtProtoDelim:
		return &protoDecoder{r: r}
	}
	return &textDecoder{r: r}
}
773062
func NewDecoder(reader io.Reader) *Decoder {
	return &Decoder{
		reader: bufio.NewReader(reader),
	}
}
303949
func NewDecoder(decoder streaming.Decoder, embeddedDecoder runtime.Decoder) *Decoder {
	return &Decoder{
		decoder:         decoder,
		embeddedDecoder: embeddedDecoder,
	}
}
612469
func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
	if d.decoder == nil {
		buffer, origData, isJSON := GuessJSONStream(d.r, d.bufferSize)
		if isJSON {
			d.decoder = json.NewDecoder(buffer)
			d.rawData = origData
		} else {
			d.decoder = NewYAMLToJSONDecoder(buffer)
		}
	}
	err := d.decoder.Decode(into)
	if jsonDecoder, ok := d.decoder.(*json.Decoder); ok {
		if syntax, ok := err.(*json.SyntaxError); ok {
			data, readErr := ioutil.ReadAll(jsonDecoder.Buffered())
			if readErr != nil {
				klog.V(4).Infof("reading stream failed: %v", readErr)
			}
			js := string(data)

			// if contents from io.Reader are not complete,
			// use the original raw data to prevent panic
			if int64(len(js)) <= syntax.Offset {
				js = string(d.rawData)
			}

			start := strings.LastIndex(js[:syntax.Offset], "\n") + 1
			line := strings.Count(js[:start], "\n")
			return JSONSyntaxError{
				Line: line,
				Err:  fmt.Errorf(syntax.Error()),
			}
		}
	}
	return err
}
405522
func ReadJSON(r io.Reader, argv interface{}) error {
	return json.NewDecoder(r).Decode(argv)
}
1019678
func jsonDecoder(body io.Reader, v interface{}) error {
	d := json.NewDecoder(body)
	return d.Decode(v)
}