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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:22:16+00:00 2026-05-15T02:22:16+00:00

I have a js object structured like: object.property1 = some string; object.property2 = some

  • 0

I have a js object structured like:

object.property1 = "some string";
object.property2 = "some string";
object.property3.property1 = "some string";
object.property3.property2 = "some string";
object.property3.property2 = "some string";

i’m using JSON.stringify(object) to pass this with ajax request. When i try to deserialize this using JavaScriptSerializer.Deserialize as a Dictionary i get the following error:

No parameterless constructor defined for type of ‘System.String’.

This exact same process is working for regular object with non “collection” properties.. thanks for any help!

  • 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-15T02:22:17+00:00Added an answer on May 15, 2026 at 2:22 am

    It’s because the deserializer doesn’t know how to handle the sub-object. What you have in JS is this:

    var x = {
      'property1' : 'string',
      'property2' : 'string',
      'property3' : { p1: 'string', p2: 'string', p3: 'string' },
    };
    

    which doesn’t have a map to something valid in C#:

    HashTable h = new HashTable();
    h.Add("property1", "string");
    h.Add("property2", "string");
    h.Add("property3", ???);
    

    The ??? is because there’s no type defined here, so how would the deserializer know what the anonymous object in your JS represents?

    Edit

    There is no way to do what you’re trying to accomplish here. You’ll need to make your object typed. For example, defining your class like this:

    class Foo{
      string property1 { get; set; } 
      string property2 { get; set; }
      Bar property3 { get; set; } // "Bar" would describe your sub-object
    }
    
    class Bar{
      string p1 { get; set; }
      string p2 { get; set; }
      string p3 { get; set; }
    }
    

    …or something to that effect.

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

Sidebar

Related Questions

I have a schema structured something like this: App = {}; App.Outer = Ember.Object.extend({
I have a data.table object like this one library(data.table) a <- structure(list(PERMNO = c(10006L,
Let's say I have objects which look very roughly like this: class object {
I have a object structure like this: public class Entity { IList<Relationship> Relationships{get;set;} }
I have a json structure that looks something like this: list:[ { type:link, href:http://google.com
I have folder structure and I would like to create JSON objects based on
I'm using ASP.NET MVC2 and I have the following object structure: public class IDealer
I have the following structure: class foo(object): class bar(object): def __init__(self, parent): self._parent=parent #this
I'm begginer in asp.net mvc and i have some doubts. P.S: I'm using DDD
I'm trying to create a controller for a custom complex object but have some

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.