IBM/JSONata4Java

Problem selecting inside arrays

dankristensen opened this issue · 1 comments

I have created this unit test, that works when using same data on try.jsonata.org. But it currently fails using JSONata4Java

public void shouldEvaluateJsonataExpression() throws Exception {
    ObjectMapper objectMapper = DatabindCodec.mapper();
    JsonNode jsonNode = objectMapper.readTree("[[\"A\",\"B\",\"C\"],[\"AA\",\"BB\",\"CC\"]]");
    Expressions expressions = Expressions.parse("$.[$[0],$[1]]");
    JsonNode evaluatedNode = expressions.evaluate(jsonNode);
    assertThat(evaluatedNode.toString(), equalTo("[[\"A\",\"B\"],[\"AA\",\"BB\"]]"));
}

Any clues on what is wrong

wnm3 commented

I think there is a bug with the $. before the array. Without that we get the same as try.jsonata.org. I'll try to look into this.