Commits

camlspotter committed 284126e

poly_variant and object_

Comments (0)

Files changed (2)

     | [] -> String tag
     | ts -> Object [tag, Array ts]
   let record tag_ts  = Object tag_ts
+  let poly_variant = variant
+  let object_ = record
 end
 
 let json_of_int       = Encode.int
   let record = function
     | Object alist -> alist
     | _ -> errorf "Object expected for record"
+
+  let poly_variant = variant
+  let object_ = record
 end
 
 open Printf

lib/json_conv.mli

   val tuple : Json.t list -> Json.t
   val variant : string -> Json.t list -> Json.t
   val record : Json.obj -> Json.t
+  val poly_variant : string -> Json.t list -> Json.t
+  val object_ : Json.obj -> Json.t
 end
 
 val json_of_int : int -> Json.t
   val tuple   : Json.t -> Json.t list
   val variant : Json.t -> string * Json.t list
   val record  : Json.t -> (string * Json.t) list
+  val poly_variant : Json.t -> string * Json.t list
+  val object_ : Json.t -> (string * Json.t) list
 end
 
 type 'a decoder = ('a, Json.t) Decoder.t