Skip to content

Commit 3d7bbf0

Browse files
authored
Merge pull request #15 from khchen/master
fix #14 (dump quote in string)
2 parents 0f9c8eb + 12960fa commit 3d7bbf0

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

jsony.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "1.0.1"
1+
version = "1.0.2"
22
author = "Andre von Houck"
33
description = "A loose direct to object json parser with hooks."
44
license = "MIT"

src/jsony.nim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ proc dumpHook*(s: var string, v: string) =
538538
of '\n': s.add r"\n"
539539
of '\r': s.add r"\r"
540540
of '\t': s.add r"\t"
541+
of '"': s.add r"\"""
541542
else:
542543
s.add c
543544
s.add '"'
@@ -567,6 +568,7 @@ proc dumpHook*(s: var string, v: string) =
567568
of '\n': ss.add '\\', 'n'
568569
of '\r': ss.add '\\', 'r'
569570
of '\t': ss.add '\\', 't'
571+
of '"': ss.add '\\', '"'
570572
else:
571573
ss.add c
572574
ss.add '"'

tests/test_tojson.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ doAssert 'a'.toJson == "\"a\""
3131
match "hi there"
3232
match "hi\nthere\b\f\n\r\t"
3333
match "как дела"
34+
match """ "quote\"inside" """
3435

3536
block:
3637
type

0 commit comments

Comments
 (0)