func appendStringify(buf []byte, s string) []byte {
	if mustMarshalString(s) {
		b, _ := jsongo.Marshal(s)
		return append(buf, b...)
	}
	buf = append(buf, '"')
	buf = append(buf, s...)
	buf = append(buf, '"')
	return buf
}
appendStringify makes a json string and appends to buf.
package sjson
import (
	jsongo "encoding/json"
	"reflect"
	"strconv"
	"unsafe"
	"github.com/tidwall/gjson"
)
type errorType struct {
	msg string
}
func (err *errorType) Error() string {
	return err.msg
}
type Options struct {
	Optimistic bool
	ReplaceInPlace bool
}
type pathResult struct {
	part  string  
	path  string  
	force bool    
	more  bool    
}
func parsePath(path string) (pathResult, error) {
	var r pathResult
	if len(path) > 0 && path[0] == ':' {
		r.force = true
		path = path[1:]
	}
	for i := 0; i < len(path); i++ {
		if path[i] == '.' {
			r.part = path[:i]
			r.path = path[i+1:]
			r.more = true
			return r, nil
		}
		if path[i] == '*' || path[i] == '?' {
			return r, &errorType{"wildcard characters not allowed in path"}
		} else if path[i] == '#' {
			return r, &errorType{"array access character not allowed in path"}
		}
		if path[i] == '\\' {
			epart := []byte(path[:i])
			i++
			if i < len(path) {
				epart = append(epart, path[i])
				i++
				for ; i < len(path); i++ {
					if path[i] == '\\' {
						i++
						if i < len(path) {
							epart = append(epart, path[i])
						}
						continue
					} else if path[i] == '.' {
						r.part = string(epart)
						r.path = path[i+1:]
						r.more = true
						return r, nil
					} else if path[i] == '*' || path[i] == '?' {
						return r, &errorType{
							"wildcard characters not allowed in path"}
					} else if path[i] == '#' {
						return r, &errorType{
							"array access character not allowed in path"}
					}
					epart = append(epart, path[i])
				}
			}
			r.part = string(epart)
			return r, nil
		}
	}
	r.part = path
	return r, nil
}
func mustMarshalString(s string) bool {
	for i := 0; i < len(s); i++ {
		if s[i] < ' ' || s[i] > 0x7f || s[i] == '"' {
			return true
		}
	}
	return false
}