Skip to content

Instantly share code, notes, and snippets.

@samcv
Created April 28, 2017 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samcv/c251784f7686a717207cd495cea3b855 to your computer and use it in GitHub Desktop.
Save samcv/c251784f7686a717207cd495cea3b855 to your computer and use it in GitHub Desktop.
sub myjson (|d) {
my $json = try require JSON::Fast <&to-json>; $json = sub (|c) { Rakudo::Internals::JSON.to-json(|c) };
&to-json.defined ?? to-json(|d) !! $json(|d);
}
say myjson 'hi';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment