Skip to content

Commit

Permalink
Fix invalid JSONPath syntax example
Browse files Browse the repository at this point in the history
  • Loading branch information
jimporter committed Nov 2, 2023
1 parent 875bf58 commit 8b4281c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ names, and indices/field names inside square brackets. The only operator
supported is `.`. For example, this is a valid expression:

```javascript
foo."bar"[0].["baz"]
foo."bar"[0]["baz"]
```

When setting values, you can add to the head or tail of a list via the `head`
Expand Down
2 changes: 1 addition & 1 deletion mike/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
and indices/field names inside square brackets. The only operator supported is
`.`. For example, this is a valid expression:
foo."bar"[0].["baz"]
foo."bar"[0]["baz"]
When setting values, you can add to the head or tail of a list via the `head`
or `tail` keywords, e.g.:
Expand Down
2 changes: 1 addition & 1 deletion mike/jsonpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
quoted field names, and indices/field names inside square brackets. The only
operator supported is ".". For example, this is a valid expression:
foo."bar"[0].["baz"]
foo."bar"[0]["baz"]
When setting values, you can add to the head or tail of a list via the `head`
or `tail` keywords, e.g.:
Expand Down
2 changes: 2 additions & 0 deletions test/unit/test_jsonpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def test_steps(self):
self.assertEqual(jsonpath.parse('foo.bar'), ['foo', 'bar'])
self.assertEqual(jsonpath.parse('foo[1].bar'), ['foo', 1, 'bar'])
self.assertEqual(jsonpath.parse('"foo.bar".baz'), ['foo.bar', 'baz'])
self.assertEqual(jsonpath.parse('foo."bar"[0]["baz"]'),
['foo', 'bar', 0, 'baz'])

def test_whitespace(self):
self.assertEqual(jsonpath.parse(' '), [])
Expand Down

0 comments on commit 8b4281c

Please sign in to comment.