Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/Newtonsoft.Json.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamesNK <james@newtonking.com>2010-12-01 11:03:02 +0300
committerJamesNK <james@newtonking.com>2010-12-01 11:03:02 +0300
commit227a34ed50cb7fd5e447088af9dce38c409fcda8 (patch)
treed24eaef65d07dd52de587cc72c5d167c97f1257b /Src/Newtonsoft.Json
parent2eb0d3bf48f1fc675de46ee94911a71ccd62c66f (diff)
-Added support for deserializing to JToken
-Improved circular reference error message with type name
Diffstat (limited to 'Src/Newtonsoft.Json')
-rw-r--r--Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs2
-rw-r--r--Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs2
2 files changed, 2 insertions, 2 deletions
diff --git a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
index 2632593..f8eccf8 100644
--- a/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
+++ b/Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
@@ -498,7 +498,7 @@ namespace Newtonsoft.Json.Serialization
if (JsonTypeReflector.GetJsonArrayAttribute(t) != null)
return CreateArrayContract(t);
- if (t.IsSubclassOf(typeof(JToken)))
+ if (t == typeof(JToken) || t.IsSubclassOf(typeof(JToken)))
return CreateLinqContract(t);
if (CollectionUtils.IsDictionaryType(t))
diff --git a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
index 5b0e75d..c9ee699 100644
--- a/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
+++ b/Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
@@ -214,7 +214,7 @@ namespace Newtonsoft.Json.Serialization
switch (referenceLoopHandling.GetValueOrDefault(Serializer.ReferenceLoopHandling))
{
case ReferenceLoopHandling.Error:
- throw new JsonSerializationException("Self referencing loop");
+ throw new JsonSerializationException("Self referencing loop detected for type '{0}'.".FormatWith(CultureInfo.InvariantCulture, value.GetType()));
case ReferenceLoopHandling.Ignore:
return false;
case ReferenceLoopHandling.Serialize: