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

$lookup() function throws an error when the property has a null value #85

Closed
shrickus opened this issue Oct 26, 2017 · 1 comment
Closed
Labels

Comments

@shrickus
Copy link

The incoming weather data object may contain some fields with null values -- like this:

{
  "temp": 22.7,
  "wind": 7,
  "gust": null,
  "timestamp": 1508971317377
}

I'm using the $lookup() function to find the "gust" value, with this expression:

{
	"x": $$.timestamp,
	"y": $lookup($$, "gust")
}

Instead of getting the property "y": null in the output object, this error is thrown instead:
Invalid operand to 'in': Object expected

Since I can use $$.gust to return the value null, this error is inconsistent and probably should be caught. I would prefer the null value to be returned, but it would also be acceptable to not create that field on the output object at all -- and would be consistent with the current behavior when trying to lookup a field that does not exist.

@andrew-coleman
Copy link
Member

Thanks for raising this. Now fixed in v1.3.3

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

No branches or pull requests

2 participants