Last active
March 9, 2020 13:04
-
-
Save Altreus/6aa5a48ea3e42cad0225dda6469bee87 to your computer and use it in GitHub Desktop.
raku json round-trip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> my @arr = 1,2,3; my $json = (to-json @arr); my @arr2 = from-json $json; @arr2.say | |
[[1 2 3]] | |
> class FromJson { has @.arr; has $.foo } | |
(FromJson) | |
> my $item = from-json '{ "arr": [1,2,3], "foo": "a value"}'; | |
{arr => [1 2 3], foo => a value} | |
> FromJson.new(|$item) | |
FromJson.new(arr => [[1, 2, 3],], foo => "a value") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment