Skip to content

Error selecting or performing operations on JSON objects containing "sequence" key #247

@apita-carecloud

Description

@apita-carecloud

node v8.9.3
jsonata v1.5.4
Also able to duplicate on JSONata Exerciser

Attempt any selection on an object with a "selection" key.

The following example works a s expected:

JSON
{ "foo": { "sequence1": 123, "bar": "baz" } }

JSONata
foo.bar

Result
"baz"

When the key is changed to "sequence", it fails:

JSON
{ "foo": { "sequence": 123, "bar": "baz" } }

JSONata
foo.bar

Result
n.value is not a function

Repo search revealed 'sequence' being used in

jsonata/src/jsonata.js

Lines 1557 to 1566 in 7aa65f2

var exitCallback = environment.lookup('__evaluate_exit');
if(exitCallback) {
exitCallback(expr, input, environment, result);
}
if(result && result.sequence) {
result = result.value();
}
return result;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions