-Added even more detail to no root XML element exception message when converting JSON to XML. Seriously, if you still get stuck here you're an idiot
-Added NullValueHandling, DefaultValueHandling and ReferenceLoopHandling to JsonPropertyAttribute -Change JsonMemberMapping from a struct to a class. Now has too many properties for a struct
This commit is contained in:
@@ -32,6 +32,7 @@ using NUnit.Framework;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Utilities;
|
||||
using System.Globalization;
|
||||
using System.Xml;
|
||||
|
||||
namespace Newtonsoft.Json.Tests.Converters
|
||||
{
|
||||
@@ -255,5 +256,26 @@ namespace Newtonsoft.Json.Tests.Converters
|
||||
string json2 = JsonConvert.SerializeObject(c, new IsoDateTimeConverter() { DateTimeStyles = DateTimeStyles.AssumeUniversal });
|
||||
Assert.AreNotEqual(json, json2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BlogCodeSample()
|
||||
{
|
||||
Person p = new Person
|
||||
{
|
||||
Name = "Keith",
|
||||
BirthDate = new DateTime(1980, 3, 8),
|
||||
LastModified = new DateTime(2009, 4, 12, 20, 44, 55),
|
||||
};
|
||||
|
||||
string jsonText = JsonConvert.SerializeObject(p, new IsoDateTimeConverter());
|
||||
// {
|
||||
// "Name": "Keith",
|
||||
// "BirthDate": "1980-03-08T00:00:00",
|
||||
// "LastModified": "2009-04-12T20:44:55"
|
||||
// }
|
||||
|
||||
Console.WriteLine(jsonText);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user