elm-community/json-extra/2.0.0

NOTE: this package is not compatible with Elm 0.19.1

Json.Encode.Extra

Convenience functions for turning Elm values into Json values.

Maybe

maybe : (a -> Value) -> Maybe a -> Value

Encode a Maybe value. If the value is Nothing it will be encoded as null

maybe int Nothing == Value null
maybe int (Just 50) == Value 50