Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4012950
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:18:39+00:00 2026-05-20T09:18:39+00:00

I am having trouble passing a JSON stringified array to a PageMethod [{ StartDate:

  • 0

I am having trouble passing a JSON stringified array to a PageMethod

[{
    "StartDate": "3/1/2011",
    "EndDate": "3/31/2011",
    "UserId": "8",
    "DdlViewSelectedValue": "zzz#",
    "DdlViewSelectedItem": "zzz",
    "DdlOrgSelectedValue": "8"
}, {
    "StartDate": "3/1/2011",
    "EndDate": "3/31/2011",
    "UserId": "9",
    "DdlViewSelectedValue": "zzz#",
    "DdlViewSelectedItem": "zzz",
    "DdlOrgSelectedValue": "8"
}, {
    "StartDate": "3/1/2011",
    "EndDate": "3/31/2011",
    "UserId": "5",
    "DdlViewSelectedValue": "zzz#",
    "DdlViewSelectedItem": "zzz",
    "DdlOrgSelectedValue": "8"
}, {
    "StartDate": "3/1/2011",
    "EndDate": "3/31/2011",
    "UserId": "13",
    "DdlViewSelectedValue": "zzz#",
    "DdlViewSelectedItem": "zzz",
    "DdlOrgSelectedValue": "8"
}, {
    "StartDate": "3/1/2011",
    "EndDate": "3/31/2011",
    "UserId": "6",
    "DdlViewSelectedValue": "zzz#",
    "DdlViewSelectedItem": "zzz",
    "DdlOrgSelectedValue": "8"
}, {
    "StartDate": "3/1/2011",
    "EndDate": "3/31/2011",
    "UserId": "11",
    "DdlViewSelectedValue": "zzz#",
    "DdlViewSelectedItem": "zzz",
    "DdlOrgSelectedValue": "8"
}]

When I get to this ajax request, ‘jsonText’ contains the data listed above

    function GetUserSchedules() {           
        var jsonText = $.toJSON(arrParams);
        $.ajax({
            type: "POST",
            url: "/myurl/jquery.aspx/GenerateUserSchedules",
            data: "{" + jsonText + "}",
            contentType: "application/json",
            dataType: "json",
            success: AjaxSucceeded
            ,
            error: AjaxFailed
        });
    }

The Pagemethod:

    [System.Web.Script.Services.ScriptMethod]
    [System.Web.Services.WebMethod]
    public static void GenerateUserSchedules(Data[] data)
    {
    //do stuff; will return data but for now, just keeping it like this
            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();       
}

The DataClass:

[Serializable]
public class Data
{
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public int UserID { get; set; }
    public string ViewSelectedValue { get; set; }
    public string ViewSelectedItem { get; set; }
    public string OrgSelectedValue { get; set; }
}

Every time the ajax request is sent the error function executes. What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:18:40+00:00Added an answer on May 20, 2026 at 9:18 am

    That’s a common issue with dates. The JavaScriptSerializer expects dates in the following format in order to parse them successfully:

    {
        "StartDate": "\/Date(983401200000)\/",
        "EndDate": "\/Date(985989600000)\/",
        "UserId": "8",
        "DdlViewSelectedValue": "zzz#",
        "DdlViewSelectedItem": "zzz",
        "DdlOrgSelectedValue": "8"
    }
    

    where 983401200000 represents the number of milliseconds since January 1, 1970 in Universal Coordinated Time (UTC).

    Quote from the documentation:

    Date object, represented in JSON as
    “\/Date(number of ticks)\/”. The
    number of ticks is a positive or
    negative long value that indicates the
    number of ticks (milliseconds) that
    have elapsed since midnight 01
    January, 1970 UTC.

    The maximum supported date value is
    MaxValue (12/31/9999 11:59:59 PM) and
    the minimum supported date value is
    MinValue (1/1/0001 12:00:00 AM).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble passing my array via a $.post. The Javascript var privIDs
I am having trouble passing data retrieved from a $.post() function to use in
I am playing around with parsing JSON in jQuery and I am having trouble.
I'm having trouble passing a pointer to a structure as an argument to a
I'm using ab to test my app, and I'm having trouble passing the correct
I'm having trouble in parsing my JSON data in jQuery autocomplete. My JSON comes
I'm trying to use PHP to process JSON and am having trouble parsing it
I'm having trouble passing a variable in the following var whichRbClicked = $('input:radio[name=RBname]:checked').val(); where
I'm building a simple web-based RSS reader in Python, but I'm having trouble parsing
Having trouble linking the Stomp.framework into an iPhone SDK application. http://code.google.com/p/stompframework/ I follow the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.