diff --git a/web/CXM_json.anubis b/web/CXM_json.anubis index a5e8859..58f4640 100644 --- a/web/CXM_json.anubis +++ b/web/CXM_json.anubis @@ -100,10 +100,13 @@ define List(Word8) { [] then new_string, [h . t] then - if (h >=+ 32 & h +=< 33) | (h >=+ 35 & h +=< 38) | (h >=+ 40 & h +=< 91) | h >=+ 93 then // Allowed characters for JSON see RFC4627 + " ' " + if (h >=+ 32 & h +=< 33) | (h >=+ 35 & h +=< 91) | h >=+ 93 then // Allowed characters for JSON see RFC4627 + " ' " Why ' ??? _format_json_esc(t, [h . new_string]) - else - _format_json_esc(t, [h, '\\' . new_string]) + else if h = '\n' then _format_json_esc(t, ['n', '\\' . new_string]) + else if h = '\r' then _format_json_esc(t, ['r', '\\' . new_string]) + else if h = '\t' then _format_json_esc(t, ['t', '\\' . new_string]) + else if h = 0x08 then _format_json_esc(t, ['b', '\\' . new_string]) //Backspace + else _format_json_esc(t, [h, '\\' . new_string]) }. public define String @@ -166,4 +169,12 @@ public define Printable_tree json_bool(b) then str_pt(if b then "true" else "false", []), json_null then str_pt("null", []) }. - + +public define WriteFileResult + write_to_file + ( + String filename, //filename where the JSON will be dump + JsonValue json //JSON to dump + )= + write_to_file(filename, format_json(json)). + -- libgit2 0.21.4