Skip to content

Commit a76a19a

Browse files
authored
Merge pull request #23 from jmespath-community/fix-slice-strings
fixes projected string slices
2 parents f2d693b + 73292ab commit a76a19a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

jmespath.test

jmespath/visitor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,9 @@ def visit_projection(self, node, value):
327327
allow_string = True
328328

329329
if isinstance(base, string_type) and allow_string:
330-
return base
330+
## projections are really sub-expressions in disguise
331+
## evaluate the rhs when lhs is a sliced string
332+
return self.visit(node['children'][1], base)
331333

332334
if not isinstance(base, list):
333335
return None

0 commit comments

Comments
 (0)