-Documentation
This commit is contained in:
@@ -180,16 +180,25 @@ or a property's object properties or collection items using
|
||||
<section>
|
||||
<title>TypeNameHandling</title>
|
||||
<content>
|
||||
<alert class="caution">
|
||||
<para>
|
||||
<codeEntityReference>T:Newtonsoft.Json.TypeNameHandling</codeEntityReference> should be used with caution when your application deserializes JSON from an external source.
|
||||
</para>
|
||||
<para>
|
||||
Incoming types should be validated with a custom <codeEntityReference>T:System.Runtime.Serialization.SerializationBinder</codeEntityReference> when deserializing with a value other than <c>TypeNameHandling.None</c>.
|
||||
</para>
|
||||
</alert>
|
||||
|
||||
<para>
|
||||
<codeEntityReference>T:Newtonsoft.Json.TypeNameHandling</codeEntityReference> controls whether Json.NET includes .NET type names
|
||||
during serialization with a $type property and reads .NET type names from that property to determine what type to create during
|
||||
deserialization.
|
||||
</para>
|
||||
<para>
|
||||
The value of the $type property can be customized by creating your own
|
||||
The value of the $type property can be customized and validated by creating your own
|
||||
<codeEntityReference>T:System.Runtime.Serialization.SerializationBinder</codeEntityReference>.
|
||||
</para>
|
||||
|
||||
|
||||
<table>
|
||||
<tableHeader>
|
||||
<row>
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
<HelpTitle>Json.NET Documentation</HelpTitle>
|
||||
<PresentationStyle>VS2013</PresentationStyle>
|
||||
<NamingMethod>MemberName</NamingMethod>
|
||||
<DocumentationSourcePath>..\Src\Newtonsoft.Json\bin\Release\Net45</DocumentationSourcePath>
|
||||
<DocumentationSourcePath>..\Working\Src\Newtonsoft.Json\bin\Release\Net45</DocumentationSourcePath>
|
||||
<DocumentationSources>
|
||||
<DocumentationSource sourceFile="$(DocumentationSourcePath)\Newtonsoft.Json.dll" />
|
||||
<DocumentationSource sourceFile="$(DocumentationSourcePath)\Newtonsoft.Json.xml" />
|
||||
|
||||
@@ -125,6 +125,16 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
Assert.AreEqual(2, myClass.PostProperty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CaseInsensitive()
|
||||
{
|
||||
string json = @"{""height"":1}";
|
||||
|
||||
DoubleClass c = JsonConvert.DeserializeObject<DoubleClass>(json, new JsonSerializerSettings { MissingMemberHandling = MissingMemberHandling.Error });
|
||||
|
||||
Assert.AreEqual(1d, c.Height);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MissingMemeber()
|
||||
{
|
||||
|
||||
@@ -138,6 +138,11 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// Gets or sets how type name writing and reading is handled by the serializer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="TypeNameHandling"/> should be used with caution when your application deserializes JSON from an external source.
|
||||
/// Incoming types should be validated with a custom <see cref="T:System.Runtime.Serialization.SerializationBinder"/>
|
||||
/// when deserializing with a value other than <c>TypeNameHandling.None</c>.
|
||||
/// </remarks>
|
||||
public virtual TypeNameHandling TypeNameHandling
|
||||
{
|
||||
get { return _typeNameHandling; }
|
||||
|
||||
@@ -156,6 +156,11 @@ namespace Newtonsoft.Json
|
||||
/// <summary>
|
||||
/// Gets or sets how type name writing and reading is handled by the serializer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="TypeNameHandling"/> should be used with caution when your application deserializes JSON from an external source.
|
||||
/// Incoming types should be validated with a custom <see cref="T:System.Runtime.Serialization.SerializationBinder"/>
|
||||
/// when deserializing with a value other than <c>TypeNameHandling.None</c>.
|
||||
/// </remarks>
|
||||
/// <value>The type name handling.</value>
|
||||
public TypeNameHandling TypeNameHandling
|
||||
{
|
||||
|
||||
@@ -24,12 +24,18 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Newtonsoft.Json
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies type name handling options for the <see cref="JsonSerializer"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <see cref="TypeNameHandling"/> should be used with caution when your application deserializes JSON from an external source.
|
||||
/// Incoming types should be validated with a custom <see cref="T:System.Runtime.Serialization.SerializationBinder"/>
|
||||
/// when deserializing with a value other than <c>TypeNameHandling.None</c>.
|
||||
/// </remarks>
|
||||
[Flags]
|
||||
public enum TypeNameHandling
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user