Closed cemerick closed 2 years ago
OCaml does not allow this syntax (the empty record {}
) so we can't support it as the payload of the extension still has to be valid OCaml.
If you need to insert empty objects in otherwise large json values, I would suggest you use antiquotation. Something along those lines:
let empty_object = `Assoc [] in
let json_value = [%yojson {some_field = [%aq empty_object]; some_other_field = ...}] in
...
or simply:
let json_value = [%yojson {some_field = [%aq `Assoc []]; some_other_field = ...}] in
...
Would that work for you?
Ach, my bad, I should have realized that before filing this. Sorry for the noise :v:
This usage:
yields
Error: Syntax error
. Likewise for any empty object within a%yojson
block. Adding any member to the object yields an`Assoc
value as expected.