Type declarations like type name = ... deriving(Json)
creates Json_name
module.
Here is example.
type card = {a: int; b: string; } deriving(Json)
type t = card list deriving(Json)
let _ =
let str = Json.to_string<t> [{a = 10; b = "abc";}; {a = 20; b = "xyz";}] in
let rs = Json.from_string<t> str in
Firebug.console##log(Js.string str);
List.iter (fun r -> Firebug.console##log_2(r.a, Js.string r.b)) rs
And I'm not sure why, I got "Uncaught ReferenceError: unix_inet_addr_of_string is not defined".
So add function unix_inet_addr_of_string () {return 0;}
to js file.