Newtonsoft.json: Unexpected end when deserializing object. Path ''

Created on 9 Dec 2014  ·  3Comments  ·  Source: JamesNK/Newtonsoft.Json

I receive this error during deserialization.
Here is my setings for serializer:

class CustomContractResolver : DefaultContractResolver
   {
      public new static readonly CustomContractResolver Instance = new CustomContractResolver();


      protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
      {
         JsonProperty property = base.CreateProperty(member, memberSerialization);
         if (property.DeclaringType == typeof(Vector3))
         {
            property.Ignored = true;
         }
         return property;
      }

      protected override JsonContract CreateContract(Type objectType)
      {
         if (objectType.GetInterfaces().Any(i => i == typeof(IDictionary) ||
            (i.IsGenericType &&
             i.GetGenericTypeDefinition() == typeof(IDictionary<,>))))
         {
            return base.CreateArrayContract(objectType);
         }
         return base.CreateContract(objectType);
      }
   }
        JsonSerializerjson = new JsonSerializer();
         json.Formatting = Formatting.Indented;
         json.ObjectCreationHandling = ObjectCreationHandling.Reuse;
         json.NullValueHandling = NullValueHandling.Ignore;
         json.StringEscapeHandling = StringEscapeHandling.Default;
         json.ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor;
         json.TypeNameHandling = TypeNameHandling.Objects;
         json.DefaultValueHandling = DefaultValueHandling.Ignore;
         json.PreserveReferencesHandling = PreserveReferencesHandling.All;
         json.ReferenceLoopHandling = ReferenceLoopHandling.Serialize;
         json.ContractResolver = new CustomContractResolver();
         serializer = new global::AdamantiumSerializer.AdamantiumSerializer();

Serialization goes well, but during deserialization I receive that error. Am I missing something?

Platform: Windows 8.1, WinRT,
Json version 6.0.6.

All 3 comments

Sorry, this is my fault. Problem is solved already.

How did you solve this?

Asking the same as above...

Was this page helpful?
0 / 5 - 0 ratings