diff options
-rw-r--r-- | lib/ur/json.ur | 2 | ||||
-rw-r--r-- | tests/jsonTest.ur | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/ur/json.ur b/lib/ur/json.ur index 7ebb010f..817ec16e 100644 --- a/lib/ur/json.ur +++ b/lib/ur/json.ur @@ -53,6 +53,7 @@ fun escape s = | #"\"" => "\\\"" | #"\'" => "\\\'" | #"\\" => "\\\\" + | #"/" => "\\/" | x => String.str ch ) ^ esc (String.suffix s 1) end @@ -102,6 +103,7 @@ fun unescape s = | #"\"" => "\"" | #"\'" => "\'" | #"\\" => "\\" + | #"/" => "/" | x => error <xml>JSON unescape: Bad escape char: {[x]}</xml>) ^ unesc (i+2) diff --git a/tests/jsonTest.ur b/tests/jsonTest.ur index 071cf34b..715e225d 100644 --- a/tests/jsonTest.ur +++ b/tests/jsonTest.ur @@ -1,7 +1,7 @@ open Json fun main () : transaction page = return <xml><body> - <pre>{[ fromJson "\"\\\\line 1\\nline 2\"" : string ]}</pre><br/> + <pre>{[ fromJson "\"\\\\line \/ 1\\nline 2\"" : string ]}</pre><br/> {[fromJson "[1, 2, 3]" : list int]}<br/> {[toJson ("hi" :: "bye\"" :: "hehe" :: [])]} </body></xml> |