-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathTest.cs
More file actions
27 lines (24 loc) · 752 Bytes
/
Test.cs
File metadata and controls
27 lines (24 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using Newtonsoft;
using Newtonsoft.Json;
using System.Web.UI.WebControls;
class Test
{
public static object Deserialize1(TextBox data)
{
return JsonConvert.DeserializeObject(data.Text, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.None // OK
});
}
public static object Deserialize2(TextBox data)
{
return JsonConvert.DeserializeObject(data.Text, new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto // BAD
});
}
public static object Deserialize(TextBox data)
{
return JsonConvert.DeserializeObject(data.Text); // OK, not checking if JsonSerializerSettings is set globally with unsafe settings
}
}