func (d *Decoder) Scan(ext *PathActions) (bool, error) {
	rootPath := d.Path()
	if rootPath.inferContext() == arrValue {
		rootPath.incTop()
	}
	for {
		_, err := d.Token()
		if err != nil {
			return false, err
		}
	match:
		var relPath JsonPath
		path := d.Path()
		if len(path) > len(rootPath) {
			relPath = path[len(rootPath):]
		} else {
			return d.Decoder.More(), nil
		}
		if node := ext.node.match(relPath); node != nil {
			if node.action != nil {
				err = node.action(d)
				if err != nil {
					return d.Decoder.More(), err
				}
				if d.path.inferContext() == arrValue && d.Decoder.More() {
					goto match
				}
			}
		}
	}
}
Scan moves forward over the JSON stream consuming all the tokens at the current level (current object, current array)
invoking each matching PathAction along the way.

Scan returns true if there are more contiguous values to scan (for example in an array).
package jsonpath
import (
	"encoding/json"
	"io"
)
type KeyString string
type Decoder struct {
	json.Decoder
	path    JsonPath
	context jsonContext
}
func NewDecoder(r io.Reader) *Decoder {
	return &Decoder{Decoder: *json.NewDecoder(r)}
}
func (d *Decoder) SeekTo(path ...interface{}) (bool, error) {
	if len(path) > 0 {
		last := len(path) - 1
		if i, ok := path[last].(int); ok {
			path[last] = i - 1
		}
	}
	for {
		if len(path) == len(d.path) && d.path.Equal(path) {
			return true, nil
		}
		_, err := d.Token()
		if err == io.EOF {
			return false, nil
		} else if err != nil {
			return false, err
		}
	}
}
func (d *Decoder) Decode(v interface{}) error {
	switch d.context {
	case objValue:
		d.context = objKey
		break
	case arrValue:
		d.path.incTop()
		break
	}
	return d.Decoder.Decode(v)
}
func (d *Decoder) Path() JsonPath {
	p := make(JsonPath, len(d.path))
	copy(p, d.path)
	return p
}
func (d *Decoder) Token() (json.Token, error) {
	t, err := d.Decoder.Token()
	if err != nil {
		return t, err
	}
	if t == nil {
		switch d.context {
		case objValue:
			d.context = objKey
			break
		case arrValue:
			d.path.incTop()
			break
		}
		return t, err
	}
	switch t := t.(type) {
	case json.Delim:
		switch t {
		case json.Delim('{'):
			if d.context == arrValue {
				d.path.incTop()
			}
			d.path.push("")
			d.context = objKey
			break
		case json.Delim('}'):
			d.path.pop()
			d.context = d.path.inferContext()
			break
		case json.Delim('['):
			if d.context == arrValue {
				d.path.incTop()
			}
			d.path.push(-1)
			d.context = arrValue
			break
		case json.Delim(']'):
			d.path.pop()
			d.context = d.path.inferContext()
			break
		}
	case float64, json.Number, bool:
		switch d.context {
		case objValue:
			d.context = objKey
			break
		case arrValue:
			d.path.incTop()
			break
		}
		break
	case string:
		switch d.context {
		case objKey:
			d.path.nameTop(t)
			d.context = objValue
			return KeyString(t), err
		case objValue:
			d.context = objKey
		case arrValue:
			d.path.incTop()
		}
		break
	}
	return t, err
}