Browse thread
picking / marshaling to strings in ocaml-revision-stable way
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Berke Durak <berke.durak@g...> |
| Subject: | Re: [Caml-list] picking / marshaling to strings in ocaml-revision-stable way |
On Sat, May 31, 2008 at 7:00 PM, Robert Fischer <robert@fischerventure.com> wrote: > How far is the reach from the Jane St S-exp library from producing JSON? I've not actually looked at it, but that'd be super nifty in the interoperation world. If you just want JSON syntax, you can use Sexplib to convert an arbitrary type to a Sexp.t type t = Atom of string | List of t list and then output in Json format: let rec output_json oc = function | Atom u -> fprintf oc "%S" u | List xl -> fprintf oc "[%a]" (fun oc xl -> List.iter (fun x -> fprintf "%a," output_json x) xl) xl You can then do the same thing for parsing. -- Berke