Skip to content

Commit b89b8ab

Browse files
Merge pull request #704 from BartelNieuwenhuyse/bugfix/jmespath_rhs-expr-mulit-select-list
JMESPath Support rhs expression in multi_select_list
2 parents 5aa7031 + eb9cf30 commit b89b8ab

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

include/jsoncons_ext/jmespath/jmespath.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4904,6 +4904,7 @@ namespace detail {
49044904
case ',':
49054905
push_token(token<Json>(separator_arg), resources, output_stack, ec);
49064906
if (JSONCONS_UNLIKELY(ec)) {return jmespath_expression{};}
4907+
state_stack.push_back(expr_state::rhs_expression);
49074908
state_stack.push_back(expr_state::lhs_expression);
49084909
++p_;
49094910
++column_;

test/jmespath/input/test.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
11
[
2+
{
3+
"given": {
4+
"value": 1,
5+
"count_children": true,
6+
"children": {
7+
"value": 2
8+
}
9+
},
10+
"cases": [
11+
{
12+
"comment": "Operator in multi-select list second element",
13+
"expression": "[value, count_children && children.value || `0`]",
14+
"result": [1, 2]
15+
},
16+
{
17+
"comment": "Operator in multi-select list first element",
18+
"expression": "[count_children && children.value || `0`, value]",
19+
"result": [2, 1]
20+
}
21+
]
22+
},
223
{
324
"given": {
425
"foz": "baz"

0 commit comments

Comments
 (0)