Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrUnexpectedEndOfComment = errors.New("unexpected end of comment")
)
Functions ¶
func DecodeBytes ¶
DecodeBytes decodes passed commented json byte slice to normal json. It modifies the passed slice. The passed slice must be refferred till returned count, if there is no error.
The error doesn't include errors related to invalid json. If not nil, it must be ErrUnexpectedEndOfComment.
The returned json must be checked for validity.
func DecodeString ¶
DecodeString decodes passed commented json to normal json. It uses "unsafe" way to convert a byte slice to result string. This saves allocations and improves performance is case of large json.
The error doesn't include errors related to invalid json. If not nil, it must be ErrUnexpectedEndOfComment.
The returned json must be checked for validity.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder represents a .jsonc decoder. It implements io.Reader.
func NewDecoder ¶
NewDecoder returns a new Decoder wrapping the provided io.Reader.
func (*Decoder) Read ¶
Read reads from underlying reader and processes the stream to omit comments. A single read doesn't guaranttee a valid JSON. Depends on length of passed slice.
Produces ErrUnexpectedEndOfComment for incomplete comments else if not nil, then it is an error from underlying reader.