diff options
author | JamesNK <james@newtonking.com> | 2010-09-19 14:36:17 +0400 |
---|---|---|
committer | JamesNK <james@newtonking.com> | 2010-09-19 14:36:17 +0400 |
commit | 8546dc4f620092053d1434b42df4dc9d05b2e08d (patch) | |
tree | 4f5eabdf6e7ba4086487f1ab1a4282efdcbd1d83 /Src/Newtonsoft.Json | |
parent | 84c40bf6d0fe00899e89262e8dcbe1b5f45756c0 (diff) |
-Added DeserializeObject overload
Diffstat (limited to 'Src/Newtonsoft.Json')
-rw-r--r-- | Src/Newtonsoft.Json/JsonConvert.cs | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/Src/Newtonsoft.Json/JsonConvert.cs b/Src/Newtonsoft.Json/JsonConvert.cs index c824cad..54b9458 100644 --- a/Src/Newtonsoft.Json/JsonConvert.cs +++ b/Src/Newtonsoft.Json/JsonConvert.cs @@ -595,9 +595,9 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the specified object to a Json object.
+ /// Deserializes the JSON to a .NET object.
/// </summary>
- /// <param name="value">The object to deserialize.</param>
+ /// <param name="value">The JSON to deserialize.</param>
/// <returns>The deserialized object from the Json string.</returns>
public static object DeserializeObject(string value)
{
@@ -605,9 +605,23 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the specified object to a Json object.
+ /// Deserializes the JSON to a .NET object.
/// </summary>
- /// <param name="value">The object to deserialize.</param>
+ /// <param name="value">The JSON to deserialize.</param>
+ /// <param name="settings">
+ /// The <see cref="JsonSerializerSettings"/> used to deserialize the object.
+ /// If this is null, default serialization settings will be is used.
+ /// </param>
+ /// <returns>The deserialized object from the JSON string.</returns>
+ public static object DeserializeObject(string value, JsonSerializerSettings settings)
+ {
+ return DeserializeObject(value, null, settings);
+ }
+
+ /// <summary>
+ /// Deserializes the JSON to the specified .NET type.
+ /// </summary>
+ /// <param name="value">The JSON to deserialize.</param>
/// <param name="type">The <see cref="Type"/> of object being deserialized.</param>
/// <returns>The deserialized object from the Json string.</returns>
public static object DeserializeObject(string value, Type type)
@@ -616,10 +630,10 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the specified object to a Json object.
+ /// Deserializes the JSON to the specified .NET type.
/// </summary>
- /// <typeparam name="T">The type of the object to deserialize.</typeparam>
- /// <param name="value">The object to deserialize.</param>
+ /// <typeparam name="T">The type of the object to deserialize to.</typeparam>
+ /// <param name="value">The JSON to deserialize.</param>
/// <returns>The deserialized object from the Json string.</returns>
public static T DeserializeObject<T>(string value)
{
@@ -627,14 +641,14 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the specified JSON to the given anonymous type.
+ /// Deserializes the JSON to the given anonymous type.
/// </summary>
/// <typeparam name="T">
/// The anonymous type to deserialize to. This can't be specified
/// traditionally and must be infered from the anonymous type passed
/// as a parameter.
/// </typeparam>
- /// <param name="value">The object to deserialize.</param>
+ /// <param name="value">The JSON to deserialize.</param>
/// <param name="anonymousTypeObject">The anonymous type object.</param>
/// <returns>The deserialized anonymous type from the JSON string.</returns>
public static T DeserializeAnonymousType<T>(string value, T anonymousTypeObject)
@@ -643,10 +657,10 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the JSON string to the specified type.
+ /// Deserializes the JSON to the specified .NET type.
/// </summary>
- /// <typeparam name="T">The type of the object to deserialize.</typeparam>
- /// <param name="value">The object to deserialize.</param>
+ /// <typeparam name="T">The type of the object to deserialize to.</typeparam>
+ /// <param name="value">The JSON to deserialize.</param>
/// <param name="converters">Converters to use while deserializing.</param>
/// <returns>The deserialized object from the JSON string.</returns>
public static T DeserializeObject<T>(string value, params JsonConverter[] converters)
@@ -655,9 +669,9 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the JSON string to the specified type.
+ /// Deserializes the JSON to the specified .NET type.
/// </summary>
- /// <typeparam name="T">The type of the object to deserialize.</typeparam>
+ /// <typeparam name="T">The type of the object to deserialize to.</typeparam>
/// <param name="value">The object to deserialize.</param>
/// <param name="settings">
/// The <see cref="JsonSerializerSettings"/> used to deserialize the object.
@@ -670,9 +684,9 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the JSON string to the specified type.
+ /// Deserializes the JSON to the specified .NET type.
/// </summary>
- /// <param name="value">The object to deserialize.</param>
+ /// <param name="value">The JSON to deserialize.</param>
/// <param name="type">The type of the object to deserialize.</param>
/// <param name="converters">Converters to use while deserializing.</param>
/// <returns>The deserialized object from the JSON string.</returns>
@@ -686,10 +700,10 @@ namespace Newtonsoft.Json }
/// <summary>
- /// Deserializes the JSON string to the specified type.
+ /// Deserializes the JSON to the specified .NET type.
/// </summary>
/// <param name="value">The JSON to deserialize.</param>
- /// <param name="type">The type of the object to deserialize.</param>
+ /// <param name="type">The type of the object to deserialize to.</param>
/// <param name="settings">
/// The <see cref="JsonSerializerSettings"/> used to deserialize the object.
/// If this is null, default serialization settings will be is used.
|