tidwall / gjson

Get JSON values quickly - JSON parser for Go
MIT License
14.1k stars 846 forks source link

Queries operators can't match empty string #246

Closed itmaple closed 2 years ago

itmaple commented 2 years ago
friends.#.nets|@flatten.#(!="")#
{
  "name": {"first": "Tom", "last": "Anderson"},
  "age":37,
  "children": ["Sara","Alex","Jack"],
  "fav.movie": "Deer Hunter",
  "friends": [
    {"first": "Dale", "last": "Murphy", "age": 44, "nets": ["ig", "", "tw"]},
    {"first": "Roger", "last": "Craig", "age": 68, "nets": ["fb", "tw"]},
    {"first": "Jane", "last": "Murphy", "age": 47, "nets": ["ig", "tw"]}
  ]
}

Result like this:

["ig","","tw","fb","tw","ig","tw"]
tidwall commented 2 years ago

I pushed a fix. Thanks for reporting!