Unmarshalling in Js_of_ocaml data serialized using native OCaml marshalling

Hi,

I have a big OCaml data structure produced by a native OCaml application, that I marshall into a file.

I would like to load the contents of this data structure into a browser, for manipulation using JavaScript code, to interactively display relevant pieces of information in response to user queries.

First question: I can invoke OCaml’s unmarshall function from Js_of_ocaml?

Second question: if my data structure involves a fair amount of sharing, do I have any hope that unmarshalling in JS would preserve the sharing? If not, any idea on how to convert an OCaml data structure with sharing into a corresponding JS data structure featuring the same sharing?

Thanks!

Yes.

Yes.

Cheers,
Nicolas

1 Like

Great, thanks! I will give it a try then.

The full details about js_of_ocaml and OCaml marshaling are on this page.

1 Like