We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to serialize Hashtbls as associative lists in JSON.
Following the example in the docs:
let yojson_of_kgram_lookup m = [%to_yojson: (int * kgram list) list] (Hashtbl.to_alist m) type project_file = { file_name: string; selected_kgrams_by_hash: ((int, kgram list) Hashtbl.t) [@to_yojson yojson_of_kgram_lookup]; } [@@deriving yojson]
I get this error:
project_compare.ml|1 col 1 error| Unbound value Hashtbl.to_yojson
The text was updated successfully, but these errors were encountered:
I was to report the following in a new issue, but it seems to me it is the same problem?
I would have expected
`Assoc [("f1", `Int 2); ("f2", `Int 2)]?
in the following?
─( 19:31:23 )─< command 0 >────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─ utop # #require "ppx_deriving_yojson";; ─( 19:31:24 )─< command 1 >────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─ utop # type ty = { f1: int [@to_yojson fun i -> `Int(succ i)]; f2: int} [@@deriving to_yojson];; type ty = { f1 : int; f2 : int; } val ty_to_yojson : ty -> Yojson.Safe.t = <fun> ─( 19:31:39 )─< command 2 >────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─ utop # ty_to_yojson {f1:1; f2:2};; utop # ty_to_yojson {f1=1; f2=2};; - : Yojson.Safe.t = `Assoc [("f1", `Int 1); ("f2", `Int 2)]
Sorry, something went wrong.
No branches or pull requests
I am trying to serialize Hashtbls as associative lists in JSON.
Following the example in the docs:
I get this error:
The text was updated successfully, but these errors were encountered: