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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:43:48+00:00 2026-06-12T04:43:48+00:00

Please help! Getting this error on Deserializing: Cannot convert object of type ‘System.String’ to

  • 0

Please help!
Getting this error on Deserializing:

Cannot convert object of type ‘System.String’ to type
‘System.Collections.Generic.List’

JSON string from client:

“\”[{\\”id\\”:\\”18_0_2_0\\”,\\”ans\\”:\\”You can enter free
text in place of
*\\”},{\\”id\\”:\\”23_1_3_1\\”,\\”ans\\”:\\”The refresh button\\”},{\\”id\\”:\\”11_2_1_2\\”,\\”ans\\”:\\”False\\”}]\””

Edit: Unescaped (see comments):

[{“id”:”18_0_2_0″,”ans”:”You can enter free text in place of *“},{“id”:”11_2_1_2″,”ans”:”False”}]

JavaScriptSerializer serializer = new JavaScriptSerializer();
List<RawAnswer> ListAnswers = serializer.Deserialize<List<RawAnswer>>(str);
 [Serializable]
public class RawAnswer
{       
    public string QuestionID { get; set; }
    public string Answer { get; set; }

    public RawAnswer() { }

}

public class AnswerList
{
    public List<RawAnswer> RawAnswer { get; set; }
}
  • 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-06-12T04:43:49+00:00Added an answer on June 12, 2026 at 4:43 am

    Your original json string(before aKzenT’s edit) was double escaped and I used var str2 = Regex.Unescape(str); to get the actual string .

    public class RawAnswer
    {
         public string id { get; set; }
         public string ans { get; set; }
    
    }
    

    And no need for AnswerList

    Now your code can work

    JavaScriptSerializer serializer = new JavaScriptSerializer();
    List<RawAnswer> ListAnswers = serializer.Deserialize<List<RawAnswer>>(str);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can some please help? I cannot figure out why I am getting this error
Please help me somebody to convert unicodestring into string This is how i am
I'm getting this error. Please help! Parser Error Description: An error occurred during the
I'm getting this error, not really sure why. Please help, this is urgent. UPDATE
I can't figure out why I'm getting this error. Please help. Traceback (most recent
Please help me why i'm getting this error. I'm getting Json response converting into
i'm new to android, i'm getting this error. please help me in providing the
Could someone please help me understand that why am I getting this error at
Please help me I am getting this error on running the bearerbox [root@localhost sbin]#
Please help me out on this explode() function issue. I am getting unexpected results

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.