ocaml-ppx / ppx_deriving_yojson

A Yojson codec generator for OCaml.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

to_yojson ?(omit_defaults=true)

vogler opened this issue · comments

It would be nice if one could also enable the output of default values.

Yes. I will not have time to implement it soon, though.

@vogler do you mean disable the output of default parameters?

I am conversing with an API which does not handle { blabla: null } the same way as {} and this feature would also be useful to me.

Should this be an additional parameter to the [@@deriving] annotation?

@michipili Yes and yes.

I worry that this isn't flexible enough perhaps. Shouldn't this be controllable at the field label level?

Makes sense.

@rgrinberg This is definitively right!