-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
example input
{
"funcs": {
"func": "$.a + $.b"
},
"a": 3,
"b": 4
}
query $eval($.funcs.func)
expected result: 7
in jsonata online https://try.jsonata.org/fU8Heq6ee work correct
simple code in test jsonata-java
@Test
public void testEvalDeep() {
Object input = Json.parseJson("{" +
" \"funcs\": {" +
" \"func\": \"$.a + $.b\"" +
" }," +
" \"a\": 3," +
" \"b\": 4" +
"}");
var expression = Jsonata.jsonata("$eval($.funcs.func)");
Object evaluate = expression.evaluate(input);
Assertions.assertEquals(7, evaluate);
}
result:
org.opentest4j.AssertionFailedError:
Expected :7
Actual :null
While debugging, I discovered that the input data is stored in a threadLocal.
When evaluatePath executes along a path, each new step stores a new input in the threadLocal. When the evaluatePath completes, the previous operation returns, and the input data remains from the evaluatePath operation.
Metadata
Metadata
Assignees
Labels
No labels