xyncro / chiron

JSON for F#
https://xyncro.tech/chiron
MIT License
175 stars 41 forks source link

Add writeUnlessDefault function #42

Closed neoeinstein closed 8 years ago

neoeinstein commented 8 years ago

There are times, especially with option types, where it is nice to be able to omit default values (that would otherwise be output as null). Json.writeUnlessDefault provides a nice complimentary function to Json.readOrDefault, which can be used to provide a default value if the expected value is omitted.

Tests included.

kolektiv commented 8 years ago

Ah yeah I think I see how this fits and makes sense. Cool, ok, I'll merge this in to dev, sort some internal tweaks out and push a new release out shortly. Thanks!