Nice one, thank you!
Yes I did a test and can confirm that does work when I modify my test jsonata expression to
{
"when" : when
}
presumably because it produces a valid JSON object.
Conversely
when
does not work as it gives just a raw integer.
Looking forward to the fix. thanks again