ppx_deriving_yojson icon indicating copy to clipboard operation
ppx_deriving_yojson copied to clipboard

to_yojson ?(omit_defaults=true)

Open vogler opened this issue 10 years ago • 6 comments

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

vogler avatar Mar 11 '15 13:03 vogler

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

whitequark avatar Mar 11 '15 13:03 whitequark

@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?

foretspaisibles avatar Jan 08 '16 17:01 foretspaisibles

@michipili Yes and yes.

whitequark avatar Jan 08 '16 19:01 whitequark

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

rgrinberg avatar Mar 31 '16 15:03 rgrinberg

Makes sense.

whitequark avatar Mar 31 '16 15:03 whitequark

@rgrinberg This is definitively right!

foretspaisibles avatar Mar 31 '16 17:03 foretspaisibles