func FindKey(in []byte, pos int, k []byte) ([]byte, error) {
	pos, err := skipSpace(in, pos)
	if err != nil {
		return nil, err
	}

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

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

		keyStart := pos
		// key
		pos, err = String(in, pos)
		if err != nil {
			return nil, err
		}
		key := in[keyStart+1 : pos-1]
		match := bytes.Equal(k, key)

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

		// colon
		pos, err = expect(in, pos, ':')
		if err != nil {
			return nil, err
		}

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

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

		if match {
			return in[valueStart:pos], nil
		}

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

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

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

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

		keyStart := pos
		
		pos, err = String(in, pos)
		if err != nil {
			return nil, err
		}
		key := in[keyStart+1 : pos-1]
		match := bytes.Equal(k, key)

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

		
		pos, err = expect(in, pos, ':')
		if err != nil {
			return nil, err
		}

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

		valueStart := pos
		
		pos, err = Any(in, pos)
		if err != nil {
			return nil, err
		}

		if match {
			return in[valueStart:pos], nil
		}

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

		switch in[pos] {
		case ',':
			pos++
		case '}':
			return nil, errKeyNotFound
		}
	}
}
func FindKey ( in [ ] byte , pos int , k [ ] byte ) ( [ ] byte , error ) { pos , err := skipSpace ( in , pos ) if err != nil { return nil , err } if v := in [ pos ] ; v != '{' { return nil , newError ( pos , v ) } pos ++ for { pos , err = skipSpace ( in , pos ) if err != nil { return nil , err } keyStart := pos // key pos , err = String ( in , pos ) if err != nil { return nil , err } key := in [ keyStart + 1 : pos - 1 ] match := bytes . Equal ( k , key ) // leading spaces pos , err = skipSpace ( in , pos ) if err != nil { return nil , err } // colon pos , err = expect ( in , pos , ':' ) if err != nil { return nil , err } pos , err = skipSpace ( in , pos ) if err != nil { return nil , err } valueStart := pos // data pos , err = Any ( in , pos ) if err != nil { return nil , err } if match { return in [ valueStart : pos ] , nil } pos , err = skipSpace ( in , pos ) if err != nil { return nil , err } switch in [ pos ] { case ',' : pos ++ case '}' : return nil , errKeyNotFound } } }
// FindKey accepts a JSON object and returns the value associated with the key specified
FindKey accepts a JSON object and returns the value associated with the key specified