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

  • Home
  • SEARCH
  • 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 463647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:11:45+00:00 2026-05-12T23:11:45+00:00

I can’t seem to find any solution to this within SO so here goes.

  • 0

I can’t seem to find any solution to this within SO so here goes.

I have a call to a WebMethod within the C# of my page like this;

$.ajax({
    type: "POST",
    url: "MyWebPage.aspx/jQueryMyWebMethod",
    data: "{FamilyType:'" + $('.HdnFamilyType').val() + "'}",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function(msg) {
        var obj = eval('(' + msg + ')');
    }
});

In the code behind I create an object, serialise it and return it like this;

LHCRequiredFormViewModel fvm = new LHCRequiredFormViewModel();
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(LHCRequiredFormViewModel));
MemoryStream ms = new MemoryStream( );
ser.WriteObject(ms, fvm);
return Encoding.Default.GetString(ms.ToArray());

However, in the Javascript when I do the eval I get the error;

Expected ‘]’;

At the point of returning the serialised object from C# the data looks like;

"{\"<IsApplicantLHCRequired>k__BackingField\":true,\"<IsPartnerLHCRequired>k__BackingField\":false}"    string

I should mention that the project was .Net 2.0 and I was simply returning a serialised object w/out all the JSON guff and it worked fine.

So I then converted to 3.5 and the problem began. It’s then that I used the JsonSerializer but am still getting exactly the same error.

Anyone know what’s going on and how to fix it?

  • 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-12T23:11:45+00:00Added an answer on May 12, 2026 at 11:11 pm

    A long time ago I had a problem similar to this. Unfortunately it was so long ago that I can’t remember how I ended up fixing it. I just know that the root cause was going from old version of .NET to 3.5.

    If my memory serves me correctly try these:
    Try using a different de-serializer on the client. Such as Json Parse from http://www.json.org/json_parse.js

    If that still doesn’t work. Try a different serializer on the server. Json.NET is free and provides a lot of control over how you want to serialize your data: http://www.codeplex.com/Json

    Or maybe I just needed to set the MimeType for the request to be text only instead of HTML.

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

Sidebar

Related Questions

Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can anyone help me trying to find out why this doesn't work. The brushes
Can anyone tell me how I can display a status message like 12 seconds
Can you have submenus with the top level set to checkable in WPF? I
can someone show me the regex for this preg_match. I want to make sure
Can't seem to get the Back Button to appear in a UINavigationController flow. I
can anybody confirm what are the currently allowed methods for peer-to-peer communications within the
Can somebody point me to a resource that explains how to go about having
Can you cast a List<int> to List<string> somehow? I know I could loop through
can you recommend some good ASP.NET tutorials or a good book? Should I jump

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.