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, 2022 in Android by Edureka
• 13,620 points
254 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
1 answer

How do I disable a Button in Flutter?

To disable a button in Flutter, you ...READ MORE

answered Mar 10, 2023 in Android by vinayak
10,144 views
0 votes
0 answers

How do I make a splash screen?

I added a splash screen because I ...READ MORE

Nov 9, 2022 in Android by Edureka
• 12,690 points
242 views
0 votes
0 answers

How do I open any app from my web browser (Chrome) in Android?

I want to use my web browser ...READ MORE

Nov 16, 2022 in Android by Edureka
• 12,690 points
352 views
0 votes
0 answers

How do I get the current GPS location programmatically in Android?

I need to get my current location ...READ MORE

Nov 23, 2022 in Android by Ashwini
• 5,430 points
517 views
0 votes
1 answer

How can I add a border to a widget in Flutter?

To add a border to a widget ...READ MORE

answered Mar 1, 2023 in Android by vishalini
7,280 views
0 votes
1 answer

How do I use hexadecimal color strings in Flutter?

To use a hexadecimal color string in ...READ MORE

answered Mar 1, 2023 in Android by vishalini
10,749 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, 2022 in C# by krishna
• 2,820 points
359 views
0 votes
0 answers

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

The following is my classes class MyDate { ...READ MORE

Sep 26, 2022 in C# by krishna
• 2,820 points
257 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
1,406 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