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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:58:29+00:00 2026-06-17T07:58:29+00:00

Consider the following tutorial: http://blogs.msdn.com/b/rakkimk/archive/2009/01/30/asp-net-json-serialization-and-deserialization.aspx { firstName : Rakki, lastName : Muthukumar, department :

  • 0

Consider the following tutorial: http://blogs.msdn.com/b/rakkimk/archive/2009/01/30/asp-net-json-serialization-and-deserialization.aspx

{
    "firstName" : "Rakki",
    "lastName" : "Muthukumar",
    "department" : "Microsoft PSS",
    "address" : {
        "addressline1" : "Microsoft India GTSC",
        "addressline2" : "PSS - DSI",
        "city" : "Bangalore",
        "state" : "Karnataka",
        "country" : "India",
        "pin" : 560028
    },
"technologies" : ["IIS", "ASP.NET", "JavaScript", "AJAX"]    
}

For the json code I have the following class:

    public class Address
{
public string addressline1 { get; set; }
public string addressline2 { get; set; }
public string city { get; set; }
public string state { get; set; }
public string country { get; set; }
public int pin { get; set; }
}

public class RootObject
{
public string firstName { get; set; }
public string lastName { get; set; }
public string department { get; set; }
public Address address { get; set; }
public List<string> technologies { get; set; }
}

The above properties give me error when I’m trying to set data like

RootObjectClsObject.address.addressline1 = "NO";

It throws me NullReferrenceException. If I modify the line

public List<string> technologies { get;set;}

by following line

public List<string> technologies = new List<string>();

Which I don’t want to use. Because I’ve complex types of JSON which can’t processed in this way.

  • 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-17T07:58:30+00:00Added an answer on June 17, 2026 at 7:58 am

    You are not initialising your sub-objects. The address property has not been assigned an instance of the Address object yet, so when you are attempting to update the address1 property; the application does not know which object you are referring to – hence the error.

    You simply need to assign a value to the address property or initialise it with a default value.

    The simplest way to do this would be in the default constructor for you RootObject class.

    public class RootObject
    {
       public RootObject()
       {
          address = new Address();
          technologies = new List<string>();
       }
    
        public string firstName { get; set; }
        public string lastName { get; set; }
        public string department { get; set; }
        public Address address { get; set; }
        public List<string> technologies { get; set; }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following article http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXPXSLT3.html says that XPATH considers the following to be nodes: Root
I'm running Rails 3.2.3 on Windows, and working on this tutorial: http://net.tutsplus.com/tutorials/ruby/the-intro-to-rails-screencast-i-wish-i-had/ . When
Consider following SWT code example: http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet151.java?view=co How can I separate the inline defined class?
Please consider the following code and the explanation from this Mozilla tutorial Using web
So I followed this tutorial from Google: http://developer.android.com/resources/tutorials/opengl/opengl-es20.html The triangle is supposed to rotate
I'm learning masm32, following some tutorials. In one tutorial: http://win32assembly.online.fr/tut3.html there is stated: LOCAL
here is part of tutorial in oracle page : Consider the following example: List
consider following codes and classes: using System.Collections.Generic; using System.IO; using System.Linq; using System.Xml.Serialization; namespace
I'm trying to create a ASP.NET MVC 2 webapp using the Northwind database following
Consider following make: all: a b a: echo a exit 1 b: echo b

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.