diff options
Diffstat (limited to 'lib/pure/json.nim')
-rwxr-xr-x | lib/pure/json.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/json.nim b/lib/pure/json.nim index 75958a55f..efadf030c 100755 --- a/lib/pure/json.nim +++ b/lib/pure/json.nim @@ -620,7 +620,8 @@ proc nl(s: var string, ml: bool) = proc escapeJson*(s: string): string = ## Converts a string `s` to its JSON representation. - result = "\"" + result = newStringOfCap(s.len + s.len shr 3) + result.add("\"") for x in runes(s): var r = int(x) if r >= 32 and r <= 127: |