tidwall / gjson

Get JSON values quickly - JSON parser for Go
MIT License
13.88k stars 841 forks source link

Expected behavior? #316

Open Anon5710 opened 1 year ago

Anon5710 commented 1 year ago

given :

yangInfo := `{"classifier-action-entry-cfg":[{"action-type":"bbf-qos-classifiers:pbit-marking","pbit-marking-cfg":{"pbit-marking-list":[{"index":0,"pbit-value":1}]}}],"filter-operation":"bbf-qos-classifiers:match-any-filter","match-criteria":{"dscp-range":"0-10","untagged":[null]},"name":"dscp-0-10-to-pbit-1_classifier"}`
Path := `classifier-action-entry-cfg.0.pbit-marking-cfg.pbit-marking-list.#[index==pbitmarkindex]`

The gjson.Get(yangInfo, Path) result is : "{"index":0,"pbit-value":1}"

Why is this the case?