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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:58:33+00:00 2026-05-26T12:58:33+00:00

I am processing JSON responses (displayed below) from a service on my Windows Phone

  • 0

I am processing JSON responses (displayed below) from a service on my Windows Phone 7 client. I am using Json.NET to deserialize them into an object, which contains List of products.

But after I deserialize, when I looked into my serviceresponse object, I can see a list of 2 products. But when I expand the product object, the fields under product (Name, ExpiryDate… etc ) are all null.

I guess my problem is with the way I have defined my serviceresponse class. Can someone help me to resolve the issue and get the correct output.

My deserialization code:

serviceresponse deserializedProduct = JsonConvert.DeserializeObject<serviceresponse>(json);

My Json response String:

{ "serviceresponse" : 

{ "company" : "ford", "success" : "Yes", "products" : [
  {"product" : 

      {
        "Name": "Product 1",
        "ExpiryDate": "\/Date(978048000000)\/",
        "Price": "99.95",
        "Sizes": "1"
      }
  },
  {"product" : 
      {
        "Name": "Product 2",
        "ExpiryDate": "\/Date(1248998400000)\/",
        "Price": "12.50",
        "Sizes": "1"
      }
  }
], "callbackformore" : "No", "message" : "1" 

    } 
}

My serviceresponse class:

[DataContract]
public class serviceresponse
{
    [DataMember]
    public String company;
    [DataMember]
    public String success;
    [DataMember]
    public List<product> products;
    [DataMember]
    public String callbackformore;
    [DataMember]
    public String message;
}

[DataContract]
public class product
{
    [DataMember]
    public String Name;
    [DataMember]
    public String ExpiryDate;
    [DataMember]
    public String Price;
    [DataMember]
    public String Sizes;
}
  • 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-26T12:58:34+00:00Added an answer on May 26, 2026 at 12:58 pm

    I ended up doing this. I found this awesome tool Jsonclassgenerator. It could generate C# classes for the input Json string. Then I opened the generated class and found how the classes are laid out. And modified my Datacontract accordingly.

    In my case, I have to create another data contract surrounding the list of objects. So it should be like this.

    [DataContract]
    public class serviceresponse
    {
        [DataMember]
        public String company;
        [DataMember]
        public String success;
        [DataMember]
        public List<product> products;
        [DataMember]
        public String callbackformore;
        [DataMember]
        public String message;
    }
    [DataContract]
    public class product
    {
        [DataMember(Name = "product")]
        public product2 _product;
    }
    [DataContract(Name = "product")]
    public class product2
    {
        [DataMember]
        public String Name;
        [DataMember]
        public String ExpiryDate;
        [DataMember]
        public String Price;
        [DataMember]
        public String Sizes;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an ASMX web service which we invoke from our ASP.NET application using
Problem: jQuery DataTables server-side processing using ASP.NET WebForms. Solution: Darin Dimitrov answered the question
String processing in C# and VB.NET is easy for me, but understanding how to
After processing form from POST I should redirect, to prevent user from hitting back.
In our processing software we are moving from one version of an external assembly
when i try to parse the response returned from a web service i got
I have a problem returning/processing JSON data while calling $.get() function. Here's the code:
I am running a following code on Windows Phone: string baseAddress = tcAddress +
I have an array of 'tasks' that I am getting back from a JSON
I'm developing an asp.net webservice application to provide json-formatted data to a widget that

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.