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

to-json doesn't like undefined values #4

Closed
timo opened this issue Sep 24, 2015 · 4 comments
Closed

to-json doesn't like undefined values #4

timo opened this issue Sep 24, 2015 · 4 comments

Comments

@timo
Copy link
Owner

timo commented Sep 24, 2015

to-json(Any) and my $foo; to-json($foo) should both generate "null".

@jonathanstowe
Copy link
Contributor

I'm going to look at this because:

[jonathan@coriolanus JSON-Marshal]$ perl6 -e 'use JSON::Fast; say to-json({foo => Str})'
Cannot unbox a type object
  in sub str-escape at sources/A670982EBE56A59B3A7611E194FB56A852C763B3 (JSON::Fast) line 5
  in sub to-json at sources/A670982EBE56A59B3A7611E194FB56A852C763B3 (JSON::Fast) line 16
  in sub to-json at sources/A670982EBE56A59B3A7611E194FB56A852C763B3 (JSON::Fast) line 39
  in block <unit> at -e line 1

It's interfering with my ability to switch to JSON::Fast

jonathanstowe added a commit to jonathanstowe/json_fast that referenced this issue Apr 19, 2016
[jonathan@coriolanus JSON-Marshal]$ perl6 -e 'use JSON::Fast; say
to-json({foo => Str})'
Cannot unbox a type object
  in sub str-escape at sources/A670982EBE56A59B3A7611E194FB56A852C763B3
(JSON::Fast) line 5
  in sub to-json at sources/A670982EBE56A59B3A7611E194FB56A852C763B3
(JSON::Fast) line 16
  in sub to-json at sources/A670982EBE56A59B3A7611E194FB56A852C763B3
(JSON::Fast) line 39
  in block <unit> at -e line 1

This now works

May partially address timo#4
timo pushed a commit that referenced this issue Apr 19, 2016
[jonathan@coriolanus JSON-Marshal]$ perl6 -e 'use JSON::Fast; say
to-json({foo => Str})'
Cannot unbox a type object
  in sub str-escape at sources/A670982EBE56A59B3A7611E194FB56A852C763B3
(JSON::Fast) line 5
  in sub to-json at sources/A670982EBE56A59B3A7611E194FB56A852C763B3
(JSON::Fast) line 16
  in sub to-json at sources/A670982EBE56A59B3A7611E194FB56A852C763B3
(JSON::Fast) line 39
  in block <unit> at -e line 1

This now works

May partially address #4
@CurtTilmes
Copy link
Contributor

Still fails for (Int), (Rat), (Num) which are processed before the return 'null' if not $obj.defined check. I'd recommend moving it above those. One could argue about (Bool -- Should that be null or false? It might break things if you change it now, so I'd recommend still leaving that as it is.

@timo timo closed this as completed Oct 5, 2018
@jonathanstowe
Copy link
Contributor

Can I 👍 a surprising two and a half year later close?

@timo
Copy link
Owner Author

timo commented Oct 5, 2018

sure. sorry for not keeping this issue tracker updated as i changed things :(

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

3 participants