scanner/array.go
func Array(in []byte, pos int) (int, error) {
	pos, err := skipSpace(in, pos)
	if err != nil {
		return 0, err
	}

	if v := in[pos]; v != '[' {
		return 0, newError(pos, v)
	}
	pos++

	// clean initial spaces
	pos, err = skipSpace(in, pos)
	if err != nil {
		return 0, err
	}

	if in[pos] == ']' {
		return pos + 1, nil
	}

	for {
		// data
		pos, err = Any(in, pos)
		if err != nil {
			return 0, err
		}

		pos, err = skipSpace(in, pos)
		if err != nil {
			return 0, err
		}

		switch in[pos] {
		case ',':
			pos++
		case ']':
			return pos + 1, nil
		}
	}
}
func Array(in []byte, pos int) (int, error) {
	pos, err := skipSpace(in, pos)
	if err != nil {
		return 0, err
	}

	if v := in[pos]; v != '[' {
		return 0, newError(pos, v)
	}
	pos++

	// clean initial spaces
	pos, err = skipSpace(in, pos)
	if err != nil {
		return 0, err
	}

	if in[pos] == ']' {
		return pos + 1, nil
	}

	for {
		// data
		pos, err = Any(in, pos)
		if err != nil {
			return 0, err
		}

		pos, err = skipSpace(in, pos)
		if err != nil {
			return 0, err
		}

		switch in[pos] {
		case ',':
			pos++
		case ']':
			return pos + 1, nil
		}
	}
}
// Array returns the position of the end of the array that begins at the position specified