Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass empty or null date in JSON for WCF REST Web service

Tags:

json

rest

wcf

We have JSON object as follows.

{
    "AdvanceNotificationDays":null,
    "Egos":[],
    "Interests":[],
    "Name":"Birthday gift for Ruchir",
    "Occasion":null,
    "OccasionDate":"\/Date(null)\/",
    "ProfileId":null,
    "UserId":4350,
    "WishlistId":0,
    "isShared":false
}

We try to pass this JSON object to the server and everything gets parsed except the Date. For date, the JSON parser throws the exception that says "Cannot parse null to Int64". We just want to pass empty date or null date to the server. Can anybody please help? We googled for solution to this issue, did not find an answer so far.

like image 961
dotcoder Avatar asked Dec 03 '25 15:12

dotcoder


1 Answers

Why don't you just set OccasionDate to null?

like image 68
Chris Avatar answered Dec 06 '25 12:12

Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!