Additional JWT Security Token Support
[mono.git] / mcs / class / System.Web.Extensions / System.Web.Script.Serialization / JavaScriptSerializer.cs
index 14a03b2f0dc9ce59f09f35a61986f6e4185c62d8..6a147e2e03ea2a7852354cce5011661c460a1b79 100644 (file)
@@ -204,7 +204,12 @@ namespace System.Web.Script.Serialization
                }
 
                public object Deserialize (string input, Type targetType) {
-                       return DeserializeObjectInternal (input);
+                       object obj = DeserializeObjectInternal (input);
+
+                       if (obj == null)
+                               return Activator.CreateInstance (targetType);
+
+                       return ConvertToType (obj, targetType);
                }
 
                static object Evaluate (object value) {