tidwall / gjson

Get JSON values quickly - JSON parser for Go
MIT License
14.39k stars 857 forks source link

Query based on content #345

Open natenho opened 10 months ago

natenho commented 10 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