JsonAttribute doesn't handle null values correclty with Value Types #357

qwe2 opened this Issue Feb 27, 2015 · 1 comment


None yet

2 participants

qwe2 commented Feb 27, 2015

Suppose I have the following record and Sitelet action:

type A = { id : int; date : System.DateTime }

type Action =
    | [<Method "POST"; Json "payload">] JsonData of A

If the JSON payload then has a null value in place of date WebSharper will return 404.

Edit: actually it would be quite interesting if it did handle it when it's not Nullable. So if I make it Nullable I get a Exception of type 'IntelliFactory.WebSharper.Sitelets.ActionEncoding+NoFormatError' was thrown. on the Sitelet initialization.

@Tarmil Tarmil closed this in 1447104 Mar 10, 2015
Tarmil commented Mar 10, 2015

Now with an option<'T> where 'T doesn't decode null, null is decoded into None.

@Tarmil Tarmil added a commit that referenced this issue Mar 10, 2015
@Tarmil Tarmil Document the #357 fix a4e8755
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment