3

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.

2 Answers 2

3

Why don't you just set OccasionDate to null?

2
  • I tried with "null" value and got the error DateTime content 'null' does not start with '\/Date(' and end with ')\/' as required for JSON.
    – dotcoder
    Jul 9, 2012 at 10:14
  • When I tried with "null" (with quotes), I got the error mentioned above. When I tried with null without quotes, It worked fine. Thanks Chris
    – dotcoder
    Jul 9, 2012 at 10:17
1

try making OccasionDate of type DateTime? so the date can be null.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.