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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:28:48+00:00 2026-06-08T17:28:48+00:00

If I have a class Contact : public class Contact { public Contact() {

  • 0

If I have a class Contact:

   public class Contact
   {
    public Contact()
    {

    }

    public int ID { get; set;}
    public string firstName { get; set;}
    public string lastName { get; set;}

    }

in my code I instantiate 5 different Contact objects and their specific properties and then put them into a List<Contact>.

My questions:

  • How can I convert the List<Contact> to JSON?
  • How can I read the JSON back to a List<Contact>?
  • How can I read from JSON the contact with ID 123 and instantiate a Contact object out of it so I have all the properties?

Much appreciated your help!
Thanks!

P.S. The JSON will look something like this ?:

{
    contacts:{
        contact:[
            {
                id:123,
                firstname:'jhon',
                lastname:'smith'
            },
            {
                id:1234,
                firstname:'robert',
                lastname:'smith'
            }
        ]
    }
}
  • 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-08T17:28:49+00:00Added an answer on June 8, 2026 at 5:28 pm

    A quick search of the web reveals suggestions for the JavaScriptSerializer

    System.Web.Script.Serialization.JavaScriptSerializer oSerializer = 
    new System.Web.Script.Serialization.JavaScriptSerializer();
    string sJSON = oSerializer.Serialize(YOUR CLASS HERE);
    

    I suggest you give it a try.

    Source here

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

Sidebar

Related Questions

I have a 'Contact' class with two properties : firstName and lastName. When I
I have a very simple object models. public class Contact { public virtual int
I have the following model: public class Contact { public Contact() { Name =
I have the following models set up: class Contact < ActiveRecord::Base belongs_to :band belongs_to
I have three classes: public partial class Student : Contact { //Inherited from Contact:
I have viewmodel which i am contructing in a Create get action, public class
I have in my code the concept of command : public abstract class BaseCommand
I have the following classes public class Contact { public Contact() { Addresses =
I've created the following POCO class and also made Contact.FirstName and Contact.LastName properties private
/// Model public class MenuModels { public Int32 MenuId { get; set; } public

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.