Skip to content

Using reserved word 'in' as key in jsonNode fails #317

Description

@ck-c8y

Hi,

when I try to parse the json payload with a reserved keyword 'in'

	expression = "in";
	String jsonPayload = "{ \"in\":1}";
	System.out.println("Using JSON:\n" + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonObj));
	System.out.println("expression=" + expression);
	expr = Expressions.parse(expression);

an exception is thrown:


com.api.jsonata4java.expressions.ParseException: line 1:0 at [@0,0:1='in',<5>,1:0]: mismatched input 'in' expecting {'(', 'true', 'false', STRING, 'null', '[', '{', '$', '$$', '**', NUMBER, FUNCTIONID, '*', '/', '-', '%', VAR_ID, ID}

        at com.api.jsonata4java.expressions.Expressions.parse(Expressions.java:113)
        at com.mytest.jsonnata.Test.test2(Test.java:105)
        at com.mytest.jsonnata.Test.main(Test.java:17)
line 1:0 at [@0,0:1='in',<5>,1:0]: mismatched input 'in' expecting {'(', 'true', 'false', STRING, 'null', '[', '{', '$', '$$', '**', NUMBER, FUNCTIONID, '*', '/', '-', '%', VAR_ID, ID}

Whereas when I use 'ink' instead of 'in' the test works.

I tested with version 2.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions