Skip to content

The $round function returns an empty string when passed a null object #308

Description

@brainesy

When passing a null object to the round function, the returned value is an empty string. A null return value would have been expected (as provided by the javascript implementation of this function). By returning a string, subsequent expressions that may check for zero values, or the existence of a value can fail.

Example using jsonata4java version 2.4.9

$data := {
    "a": 1,
    "b": 2
};

$result := $round( $data.xyz, 0);

Expected result: null (i.e: no result)
Actual result: ""
Result using Javascript version 2.0.5: null / undefined / ** no match **

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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