-Fixed error when deserializing nullable structs

-Fixed writing JSON Schema option label
-Improved error message when converting JSON with an empty property to XML
This commit is contained in:
JamesNK
2010-10-22 23:23:49 +00:00
parent 1703992773
commit 15ea91fb63
8 changed files with 283 additions and 58 deletions
@@ -906,6 +906,92 @@ namespace Newtonsoft.Json.Tests.Converters
Assert.AreEqual(expectedXmlJson, xmlJson);
}
[Test]
[ExpectedException(typeof(JsonSerializationException), ExpectedMessage = "XmlNodeConverter cannot convert JSON with an empty property name to XML.")]
public void EmptyPropertyName()
{
string json = @"{
""8452309520V2"": {
"""": {
""CLIENT"": {
""ID_EXPIRATION_1"": {
""VALUE"": ""12/12/2000"",
""DATATYPE"": ""D"",
""MSG"": ""Missing Identification Exp. Date 1""
},
""ID_ISSUEDATE_1"": {
""VALUE"": """",
""DATATYPE"": ""D"",
""MSG"": ""Missing Identification Issue Date 1""
}
}
},
""457463534534"": {
""ACCOUNT"": {
""FUNDING_SOURCE"": {
""VALUE"": ""FS0"",
""DATATYPE"": ""L"",
""MSG"": ""Missing Source of Funds""
}
}
}
}
}{
""34534634535345"": {
"""": {
""CLIENT"": {
""ID_NUMBER_1"": {
""VALUE"": """",
""DATATYPE"": ""S"",
""MSG"": ""Missing Picture ID""
},
""ID_EXPIRATION_1"": {
""VALUE"": ""12/12/2000"",
""DATATYPE"": ""D"",
""MSG"": ""Missing Picture ID""
},
""WALK_IN"": {
""VALUE"": """",
""DATATYPE"": ""L"",
""MSG"": ""Missing Walk in""
},
""PERSONAL_MEETING"": {
""VALUE"": ""PM1"",
""DATATYPE"": ""L"",
""MSG"": ""Missing Met Client in Person""
},
""ID_ISSUEDATE_1"": {
""VALUE"": """",
""DATATYPE"": ""D"",
""MSG"": ""Missing Picture ID""
},
""PHOTO_ID"": {
""VALUE"": """",
""DATATYPE"": ""L"",
""MSG"": ""Missing Picture ID""
},
""ID_TYPE_1"": {
""VALUE"": """",
""DATATYPE"": ""L"",
""MSG"": ""Missing Picture ID""
}
}
},
""45635624523"": {
""ACCOUNT"": {
""FUNDING_SOURCE"": {
""VALUE"": ""FS1"",
""DATATYPE"": ""L"",
""MSG"": ""Missing Source of Funds""
}
}
}
}
}";
DeserializeXmlNode(json);
}
}
}
#endif