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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:54:51+00:00 2026-06-02T11:54:51+00:00

I have a json custom converter using the standard asp.net library. My converter looks

  • 0

I have a json custom converter using the standard asp.net library.
My converter looks like this:

public class MyObjectToJson : JavaScriptConverter

  public override IDictionary<string, object> Serialize(object obj, JavaScriptSerializer serializer)
  {
     MyObject TheObject = obj as MyObject;
     Dictionary<string, object> OutputJson = new Dictionary<string, object>();

     OutputJson.Add("SomeProperty", TheObject.Property1);

     //line that I'm not figuring out
     //I have a type MyNestedObject nested in the object model of MyObject
     //I added that nested converter in the SupportedTypes method    

     OutputJson.Add("TheNestedObject",....?);

     return OutputJson;
   }

   public override IEnumerable<Type> SupportedTypes
   {
      get { return new Type[] { typeof(MyObject), typeof(MyNestedObject) }; }
   }

Basically, I have another json custom converter that’s called MyNestedObjectJson but I’m wondering where to plug it in.

  • 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-02T11:54:57+00:00Added an answer on June 2, 2026 at 11:54 am

    ok, I figured it out. I’m adding this answer for those who land on this page through google. It’s really so super simple:

    In the calling code, you register the converter of the nested object like this:

    JavaScriptSerializer TheSerializer = new JavaScriptSerializer();
    
    TheSerializer.RegisterConverters(new JavaScriptConverter[] { 
      new MyObjectToJson(), new MyNestedObjectToJson() 
    });
    

    And then, in the json converter of the parent object, you simply write the line I had trouble with like this:

    OutputJson.Add("TheNestedObject", TheObject.TheNestedObject);
    

    Since the serializer has both converters registered, the converter of the nested object will kick in.

    Hope this helps some.

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

Sidebar

Related Questions

I have JSON text that looks like this: { ok: true, totalPages: 256, arReports:
I have an object like this: class MyObject { public string Object.Prop1 { get;
I am using google Api for custom search and have done the json Parsing.
i have json data like this {GetStudentDetails: {TotalCount:5, RootResults:[ {city:West Chester,country:USA,state:PA ,student_id:100}, {city:Philly,country:USA,state:PA,student_id:101}, {city:Buffalo,country:USA,state:NY,student_id:102},
I'm using a custom Django field to represent JSON encoded data: class JSONField(models.TextField): __metaclass__
I have a JSON structure like this: { id:100 contactInfo: { name: John Doe
I have a JAX-RS resource and I'd like to use a custom JSON serializer
I have my form information in a JSON object(Custom Format). Now i have to
Am new to jquery. Have json response from php in this format. { div1:{data:minute=0,hour=27,day=649,month=19K,smallSize=0,
I have a json file being stored in a static url, i would like

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.