ohler55 / ojg

Optimized JSON for Go
MIT License
857 stars 49 forks source link

Does support ”-“ #125

Closed xdlbdy closed 1 year ago

xdlbdy commented 1 year ago

The JSON is like {"key-1": "value"}, and my code is p, err := jp.ParseString("$.key-1"), then the err is not nil

ohler55 commented 1 year ago

That is expected behaviour. The - character is not a valid unquoted token since it can be confused with the subtraction operation in filters. You should use the bracket notation instead ['key-1'].