Hi,
is there a way to send bigarrays through JSON with the ocplib-json lib ?
I’m trying to create an object with a bigarray, a width and a height but I can’t use the array constructor for array. I don’t find something to build bigarray encoding fields.
Actually it looks like this:
type image_struct =
Image of int * int * (int, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t
let enc =
let open Json_encoding in
union [
case
(obj3
(req "data" (array int)) (* This type blocks me... *)
(req "width" int)
(req "height" int))
(function
| Image (data, w, h) -> Some (data, w, h)
| _ -> None)
(function
| (data, w, h) -> Image (data, w, h)) ]