Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to differentiate between null and not existing? #59

Open
ck-c8y opened this issue Dec 18, 2024 · 1 comment
Open

How to differentiate between null and not existing? #59

ck-c8y opened this issue Dec 18, 2024 · 1 comment

Comments

@ck-c8y
Copy link

ck-c8y commented Dec 18, 2024

  1. When I evaluate the expression nullField against the document:
    { "nullField": null }
    I get null.

  2. When I evaluate the expressions nonExistingField against the same document I still get: null.

When I run the same test in the JSONata Exerciser I get:

  1. null
  2. ** no match **

How can I differentiate these two cases in jsonata-java ?

@aeberhart
Copy link
Contributor

Right now you cannot. This is a design decision in order to avoid having to use a JSON lib like Jackson (see README).
Internally, we use an Object to represent null: see:

com.dashjoin.jsonata.Jsonata.NULL_VALUE
com.dashjoin.jsonata.Utils.convertNulls(Object)

We could introduce a mode that sends this to the caller. Did not do that because seemed unintuitive to have to check for null and NULL_VALUE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants