Skip to content

Commit

Permalink
no need for paranoid over-stringification, again
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Dec 21, 2011
1 parent 48a34c5 commit 89e7d18
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/JSON/Tiny.pm
Expand Up @@ -24,7 +24,7 @@ multi to-json(Real:D $d) { ~$d }
multi to-json(Bool:D $d) { $d ?? 'true' !! 'false'; } multi to-json(Bool:D $d) { $d ?? 'true' !! 'false'; }
multi to-json(Str:D $d) { 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'])\ => ['\"', '\\\\', '\b', '\f', '\n', '\r', '\t'])\
.subst(/<-[\c32..\c126]>/, { ord(~$_).fmt('\u%04x') }, :g) .subst(/<-[\c32..\c126]>/, { ord(~$_).fmt('\u%04x') }, :g)
~ '"' ~ '"'
Expand Down

0 comments on commit 89e7d18

Please sign in to comment.