How do I turn a C object into a JSON string in NET

0 votes

I have classes like these:

class MyDate
{
    int year, month, day;
}

class Lad
{
    string firstName;
    string lastName;
    MyDate dateOfBirth;
}

And I would like to turn a Lad object into a JSON string like this:

{
    "firstName":"Rohit",
    "lastName":"Sharma",
    "dateOfBirth":
    {
        "year":"1901",
        "month":"4",
        "day":"30"
    }
}

I discovered this link, but.NET 4 doesn't support the namespace it uses. JSON.NET is another option I've heard about, but I don't like the idea of requiring external DLL files, and their website currently appears to be unavailable.

Exist any other choices except writing a JSON string writer by hand?

Sep 20 in Android by Edureka
• 11,040 points
13 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Android

0 votes
0 answers

What are the differences between C, C# and C++ in terms of real-world applications?

As I stated in an earlier article, ...READ MORE

Sep 20 in Android by Edureka
• 11,040 points
12 views
0 votes
0 answers

What is the difference between C# and .NET?

May I know what is the difference ...READ MORE

Sep 20 in Android by Edureka
• 11,040 points
13 views
0 votes
0 answers

How to make grid view scroll horizontally not vertically in android?

I use a flexible Grid View. means ...READ MORE

Sep 21 in Android by Edureka
• 11,040 points
9 views
0 votes
0 answers

What does LayoutInflater in Android do?

What is the use of LayoutInflater in ...READ MORE

Sep 22 in Android by Edureka
• 11,040 points
7 views
0 votes
0 answers
0 votes
0 answers

Factorial program in android

Hey guys, I am aware that there ...READ MORE

Sep 21 in Android by Edureka
• 11,040 points
13 views
0 votes
1 answer

How do I turn a C# object into a JSON string in .NET

Newtonsoft.json can be used to accomplish this. ...READ MORE

answered Jun 13 in C# by krishna
• 2,640 points
45 views
0 votes
1 answer
0 votes
2 answers

Is there a .NET equivalent to Apache Hadoop?

Hadoop is a Java-based platform. So, to ...READ MORE

answered Jul 16, 2020 in Big Data Hadoop by Suhana
• 340 points
706 views
0 votes
1 answer

Validate String against USPS State Abbreviations

Try something like this: private static String states ...READ MORE

answered Sep 20, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
244 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP