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 7189277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:16:06+00:00 2026-05-28T19:16:06+00:00

I am having trouble sending JSON to a WebMethod. Here is the way that

  • 0

I am having trouble sending JSON to a WebMethod. Here is the way that I am trying to do it. If there is a better way to do this please let me know. What I am trying to do is save the JSON object off in a database.

JavaScript

function TEST() {
    var str = '[{
        "Key": 6311,
        "Start": "123 Start",
        "End": "456 End ",
        "Date": "2/2/2012",
        "Order": null,
        "EstMiles": 0,
        "Stops": [
            {"StopAddy": "123 Stop Addy "},
            {"StopAddy": "456 Stop Addy"},
            {"StopAddy": "789 Stop Addy"}
        ]
    }]';    // Whitespace added for clarity

    $.ajax({
        type: "POST",
        url: "WebService1.asmx/Test",
        data: str,
        //contentType: "plain/text",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            alert(msg.d);
        },
        error: function(e) {
            alert(e.responseText);
        }
    });
} 

VB.NET

Public Function Test(ByVal o As Object()) As String
    'do your processing  
    Return "success"
End Function

Public Class [Stop]
    Public Property StopAddy() As String
        Get
            Return m_StopAddy
        End Get
        Set(ByVal value As String)
            m_StopAddy = value
        End Set
    End Property
    Private m_StopAddy As String
End Class

Public Class RootObject
    Public Property Key() As Integer
        Get
            Return m_Key
        End Get
        Set(ByVal value As Integer)
            m_Key = value
        End Set
    End Property
    Private m_Key As Integer
    Public Property Start() As String
        Get
            Return m_Start
        End Get
        Set(ByVal value As String)
            m_Start = value
        End Set
    End Property
    Private m_Start As String
    Public Property [End]() As String
        Get
            Return m_End
        End Get
        Set(ByVal value As String)
            m_End = value
        End Set
    End Property
    Private m_End As String
    Public Property [Date]() As String
        Get
            Return m_Date
        End Get
        Set(ByVal value As String)
            m_Date = value
        End Set
    End Property
    Private m_Date As String
    Public Property Order() As Object
        Get
            Return m_Order
        End Get
        Set(ByVal value As Object)
            m_Order = value
        End Set
    End Property
    Private m_Order As Object
    Public Property EstMiles() As Integer
        Get
            Return m_EstMiles
        End Get
        Set(ByVal value As Integer)
            m_EstMiles = value
        End Set
    End Property
    Private m_EstMiles As Integer
    Public Property Stops() As List(Of [Stop])
        Get
            Return m_Stops
        End Get
        Set(ByVal value As List(Of [Stop]))
            m_Stops = value
        End Set
    End Property
    Private m_Stops As List(Of [Stop])
End Class

The error I am getting is

{“Message”:”Type \u0027System.Collections.Generic.IDictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]\u0027 is not supported for deserialization of an array.”,”StackTrace”:”
   at System.Web.Script.Serialization.ObjectConverter.ConvertListToObject(IList list, Type type, JavaScriptSerializer serializer, Boolean throwOnError, IList& convertedList)
   at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)\r\n
   at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)\r\n
   at System.Web.Script.Serialization.ObjectConverter.ConvertObjectToType(Object o, Type type, JavaScriptSerializer serializer)\r\n
   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n
   at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n
   at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n
   at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n
   at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)”,
“ExceptionType”:”System.InvalidOperationException”}

  • 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-28T19:16:07+00:00Added an answer on May 28, 2026 at 7:16 pm

    Based on your stack trace, I assume you are using Asp.net on the server side?
    If so, I believe Asp.net requires you to have a main object that wraps list of objects for json data. So, please change your input to the following, and change your server code a bit to handle the extra wrapping layer:

    var str = '{
    "data": 
    [
        {
            "Key": 6311,
            "Start": "123 Start",
            "End": "456 End ",
            "Date": "2/2/2012",
            "Order": null,
            "EstMiles": 0,
            "Stops": [
                {
                    "StopAddy": "123 Stop Addy "
                },
                {
                    "StopAddy": "456 Stop Addy"
                },
                {
                    "StopAddy": "789 Stop Addy"
                }
            ]
        }
    ]
    }'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are similar questions out there, but I'm having trouble with this
I was having trouble sending up a url containing accent characters using IE. Here's
I`m having trouble trying to optimize this query with OVER (PARTITION BY ...) because
I'm having trouble getting a UIWebView to load a URL that I'm sending to
I am trying to use Django with jquery UI autocomplete but having trouble sending
I'm having trouble sending out a simple HTTP request using Actionscript 3's Socket() object.
Having trouble with proper regex for RewriteCond RewriteCond %{REQUEST_URI} !^/foo/ Works as expected, that
I'm having trouble sending data to a different view using the prepareForSegue method… I
Having some trouble sending properly formatted HTML e-mail from a PHP script. I am
I'm having some trouble sending $_FILES by cURL - the files get transferred alright

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.