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:
(我想将Lad
对象变成这样的JSON字符串:)
{
"firstName":"Markoff",
"lastName":"Chaney",
"dateOfBirth":
{
"year":"1901",
"month":"4",
"day":"30"
}
}
(without the formatting).
((不带格式)。)
I found this link , but it uses a namespace that's not in .NET 4. I also heard about JSON.NET , but their site seems to be down at the moment, and I'm not keen on using external DLL files. (我找到了此链接 ,但是它使用的不是.NET 4中的命名空间。我也听说过JSON.NET ,但是目前它们的站点似乎已关闭,并且我不热衷于使用外部DLL文件。)
Are there other options besides manually creating a JSON string writer? (除了手动创建JSON字符串编写器外,还有其他选择吗?)
ask by Hui translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…