tidwall / gjson

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

Query based on content #345

Open natenho opened 6 months ago

natenho commented 6 months ago

Hello @tidwall! Given the playground case, with a little modification:

{
  "name": {"first": "Tom", "last": "Anderson"},
  "age":37,
  "children": ["Sara","Alex","Jack"],
  "fav.movie": "Deer Hunter",
  "friends": [
    {"first": "Dale", "last": "Murphy", "age": 44, "size": 23, "nets": ["ig", "fb", "tw"]},
    {"first": "Roger", "last": "Craig", "age": 68, "size": 68,"nets": ["fb", "tw"]},
    {"first": "Jane", "last": "Murphy", "age": 47, "size": 23,"nets": ["ig", "tw"]}
  ]
}

I want to query friends.#(size==age)#, to get all friends with age equals to the size field.

Any idea on how to do that?

image