psy1337/JSON-Grep — Issue #12: example from http://jgrep.org/#howto fails
Author: hartrock
Created: 2012-01-24 14:42:06+00:00
State: open

See comments starting with '==>':

In-document comparison

If a document contains an array, the '[' and ']' symbols can be used to define a comparison where statements are checked for truth on a per element basis which will then be combined. Consider:

[foo.bar1=1 and foo.bar2=2]

on:

[
{
"foo": [
{
"bar1":1
},
{
"bar2":2
}
],
},
{
"foo": [
{
"bar1":0
},
{
"bar2":0
}
]
}
]

==> invalid JSON!

will return:

[
{
"foo": [
{
"bar1": 1
},
{
"bar2": 2
}
]
}
]

==> query applied to corrected JSON (',' after last obj elem deleted) returns nothing; but querying with
"foo.bar1=1 and foo.bar2=2"
works.
jgrep-1.3.1, ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]

Note: In-document comparison cannot be nested.