package jsoniter

import (
	
	
)

// RawMessage to make replace json with jsoniter
type RawMessage []byte

// Unmarshal adapts to json/encoding Unmarshal API
//
// Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v.
// Refer to https://godoc.org/encoding/json#Unmarshal for more information
func ( []byte,  interface{}) error {
	return ConfigDefault.Unmarshal(, )
}

// UnmarshalFromString is a convenient method to read from string instead of []byte
func ( string,  interface{}) error {
	return ConfigDefault.UnmarshalFromString(, )
}

// Get quick method to get value from deeply nested JSON structure
func ( []byte,  ...interface{}) Any {
	return ConfigDefault.Get(, ...)
}

// Marshal adapts to json/encoding Marshal API
//
// Marshal returns the JSON encoding of v, adapts to json/encoding Marshal API
// Refer to https://godoc.org/encoding/json#Marshal for more information
func ( interface{}) ([]byte, error) {
	return ConfigDefault.Marshal()
}

// MarshalIndent same as json.MarshalIndent. Prefix is not supported.
func ( interface{}, ,  string) ([]byte, error) {
	return ConfigDefault.MarshalIndent(, , )
}

// MarshalToString convenient method to write as string instead of []byte
func ( interface{}) (string, error) {
	return ConfigDefault.MarshalToString()
}

// NewDecoder adapts to json/stream NewDecoder API.
//
// NewDecoder returns a new decoder that reads from r.
//
// Instead of a json/encoding Decoder, an Decoder is returned
// Refer to https://godoc.org/encoding/json#NewDecoder for more information
func ( io.Reader) *Decoder {
	return ConfigDefault.NewDecoder()
}

// Decoder reads and decodes JSON values from an input stream.
// Decoder provides identical APIs with json/stream Decoder (Token() and UseNumber() are in progress)
type Decoder struct {
	iter *Iterator
}

// Decode decode JSON into interface{}
func ( *Decoder) ( interface{}) error {
	if .iter.head == .iter.tail && .iter.reader != nil {
		if !.iter.loadMore() {
			return io.EOF
		}
	}
	.iter.ReadVal()
	 := .iter.Error
	if  == io.EOF {
		return nil
	}
	return .iter.Error
}

// More is there more?
func ( *Decoder) () bool {
	 := .iter
	if .Error != nil {
		return false
	}
	 := .nextToken()
	if  == 0 {
		return false
	}
	.unreadByte()
	return  != ']' &&  != '}'
}

// Buffered remaining buffer
func ( *Decoder) () io.Reader {
	 := .iter.buf[.iter.head:.iter.tail]
	return bytes.NewReader()
}

// UseNumber causes the Decoder to unmarshal a number into an interface{} as a
// Number instead of as a float64.
func ( *Decoder) () {
	 := .iter.cfg.configBeforeFrozen
	.UseNumber = true
	.iter.cfg = .frozeWithCacheReuse(.iter.cfg.extraExtensions)
}

// DisallowUnknownFields causes the Decoder to return an error when the destination
// is a struct and the input contains object keys which do not match any
// non-ignored, exported fields in the destination.
func ( *Decoder) () {
	 := .iter.cfg.configBeforeFrozen
	.DisallowUnknownFields = true
	.iter.cfg = .frozeWithCacheReuse(.iter.cfg.extraExtensions)
}

// NewEncoder same as json.NewEncoder
func ( io.Writer) *Encoder {
	return ConfigDefault.NewEncoder()
}

// Encoder same as json.Encoder
type Encoder struct {
	stream *Stream
}

// Encode encode interface{} as JSON to io.Writer
func ( *Encoder) ( interface{}) error {
	.stream.WriteVal()
	.stream.WriteRaw("\n")
	.stream.Flush()
	return .stream.Error
}

// SetIndent set the indention. Prefix is not supported
func ( *Encoder) (,  string) {
	 := .stream.cfg.configBeforeFrozen
	.IndentionStep = len()
	.stream.cfg = .frozeWithCacheReuse(.stream.cfg.extraExtensions)
}

// SetEscapeHTML escape html by default, set to false to disable
func ( *Encoder) ( bool) {
	 := .stream.cfg.configBeforeFrozen
	.EscapeHTML = 
	.stream.cfg = .frozeWithCacheReuse(.stream.cfg.extraExtensions)
}

// Valid reports whether data is a valid JSON encoding.
func ( []byte) bool {
	return ConfigDefault.Valid()
}