Binding JSONiq variables to Python values
print(rumble.jsoniq("""
for $v in $c
let $parity := $v mod 2
group by $parity
return { switch($parity)
case 0 return "even"
case 1 return "odd"
default return "?" : $v
}
""", c=(1,2,3,4, 5, 6)).json())
print(rumble.jsoniq("""
for $i in $c
return [
for $j in $i
return { "foo" : $j }
]
""", c=([1,2,3],[4,5,6])).json())
print(rumble.jsoniq('{ "results" : $c.foo[[2]] }',
c=({"foo":[1,2,3]},{"foo":[4,{"bar":[1,False, None]},6]})).json())Last updated