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

.json() does not recognize null #85

Closed
kseistrup opened this issue Dec 27, 2018 · 1 comment · Fixed by #90
Closed

.json() does not recognize null #85

kseistrup opened this issue Dec 27, 2018 · 1 comment · Fixed by #90
Labels
bug Something isn't working
Milestone

Comments

@kseistrup
Copy link

When converting a string to JSON, null is not recognized:

⧐  "{\"x\": null}".json()
ERROR: identifier not found: null

However:

⧐  {"x": true}.x
true
⧐  {"x": true}.y
null
@odino odino added the bug Something isn't working label Dec 27, 2018
@odino odino added this to the preview-3 milestone Dec 27, 2018
@odino
Copy link
Collaborator

odino commented Dec 27, 2018

The issue is that null is not a valid identifier, and you can't assign null to a value (though the interpreter assigns null at will, for example when destructuring):

⧐  x = null
ERROR: identifier not found: null
⧐  [a, b] = [1]
⧐  b
null

This shouldn't be crazy, let's see if I can have a look at it over the next couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants