JSON-Grep icon indicating copy to clipboard operation
JSON-Grep copied to clipboard

example from http://jgrep.org/#howto fails

Open hartrock opened this issue 13 years ago • 3 comments

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 "foo" elem in first obj deleted) returns nothing; but querying with "foo.bar1=1 and foo.bar2=2" works. jgrep-1.3.1 (installed by gem), ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]

hartrock avatar Jan 24 '12 14:01 hartrock

Thanks, its been fixed.

ploubser avatar Jan 25 '12 13:01 ploubser

You have not fixed the query: [foo.bar1=1 and foo.bar2=2] does not work, but foo.bar1=1 and foo.bar2=2 does.

hartrock avatar Feb 02 '12 14:02 hartrock

Thanks, going to rewrite that section to make the example a bit more clear.

ploubser avatar Feb 02 '12 16:02 ploubser