Permalink
Browse files

no need for paranoid over-stringification, again

  • Loading branch information...
moritz committed Dec 21, 2011
1 parent 48a34c5 commit 89e7d1827e2829afbd304a7080c99bc4cecabe6d
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/JSON/Tiny.pm
View
@@ -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)
~ '"'

0 comments on commit 89e7d18

Please sign in to comment.