Commits

Dmitry Grebeniuk  committed 1e9ca07

Cd_Json: {from,to}_json_string

  • Participants
  • Parent commits 872fd91

Comments (0)

Files changed (1)

File src/cd_Json.ml

 ;
 
 
+value from_json_string ti str =
+  let j =
+    Json_io.json_of_string
+      ~allow_comments:True
+      ~allow_nan:True
+      ~big_int_mode:False
+      ~recursive:True
+      str
+  in
+    from_json ti j
+;
+
+
+value to_json_string ti a =
+  let j = to_json ti a in
+  let b = Buffer.create 100 in
+  let () = Json_io.Fast.print
+    ~allow_nan:True
+    ~recursive:True
+    b
+    j
+  in
+    Buffer.contents b
+;
+
+
 (* todo: сделать нормальные параметризованные типы блеять *)
 value ti_list_add_json
  : #ti (list 'a) -> #ti 'a -> unit