Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

no need for paranoid over-stringification, again

  • Loading branch information...
commit 89e7d1827e2829afbd304a7080c99bc4cecabe6d 1 parent 48a34c5
@moritz authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/JSON/Tiny.pm
View
2  lib/JSON/Tiny.pm
@@ -24,7 +24,7 @@ multi to-json(Real:D $d) { ~$d }
multi to-json(Bool:D $d) { $d ?? 'true' !! 'false'; }
multi to-json(Str:D $d) {
'"'
- ~ (~$d).trans(['"', '\\', "\b", "\f", "\n", "\r", "\t"]
+ ~ $d.trans(['"', '\\', "\b", "\f", "\n", "\r", "\t"]
=> ['\"', '\\\\', '\b', '\f', '\n', '\r', '\t'])\
.subst(/<-[\c32..\c126]>/, { ord(~$_).fmt('\u%04x') }, :g)
~ '"'
Please sign in to comment.
Something went wrong with that request. Please try again.