-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
当字符串里面本身带有引号时,json->string方法输出的格式有问题。需要对字符串进行转换处理。
使用你的core库解决此问题。
$ git diff -w HEAD
diff --git a/json.sc b/json.sc
index 29f92e1..6748fd3 100644
--- a/json.sc
+++ b/json.sc
@@ -36,6 +36,7 @@
(import
(scheme)
(only (core alist) vector->alist)
+ (only (core string) string-replace)
)
@@ -131,7 +132,7 @@
(define f
(lambda (x)
(cond
- ((string? x) (string-append "\"" x "\""))
+ ((string? x) (string-append "\"" (string-replace x "\"" "\\\"") "\""))
((number? x) (number->string x))
((symbol? x) (symbol->string x)))))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels