Skip to content

ParseException on valid JSONata with parameter as key in object constructor #144

Description

@robertvanloenhout

Given any input and the following JSONata:

(
$myfunction := function ($key, $value) {
  {
    $key: $value
  }
};
$myfunction('key', 'value')
)

This produces the following error:

Exception in thread "main" com.api.jsonata4java.expressions.ParseException: line 4:4 at [@11,51:54='$key',<41>,4:4]: no viable alternative at input 'function($key,$value){{$key'

It produces no error on https://try.jsonata.org/
It seems that a param as key for object constructors is not allowed, but it should be.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions