Inheritance: JsonSerializerInternalBase
Exemplo n.º 1
0
        public JsonSerializerProxy(JsonSerializerInternalReader serializerReader)
        {
            ValidationUtils.ArgumentNotNull(serializerReader, "serializerReader");

            _serializerReader = serializerReader;
            _serializer       = serializerReader.Serializer;
        }
Exemplo n.º 2
0
        public JsonSerializerProxy(JsonSerializerInternalReader serializerReader)
        {
            ValidationUtils.ArgumentNotNull(serializerReader, "serializerReader");

              _serializerReader = serializerReader;
              _serializer = serializerReader.Serializer;
        }
 public JsonFormatterConverter(JsonSerializerInternalReader reader, JsonISerializableContract contract, JsonProperty member)
 {
     ValidationUtils.ArgumentNotNull(reader, "reader");
     ValidationUtils.ArgumentNotNull(contract, "contract");
     this._reader   = reader;
     this._contract = contract;
     this._member   = member;
 }
Exemplo n.º 4
0
 public JsonSerializerProxy(JsonSerializerInternalReader serializerReader)
 {
     Class6.yDnXvgqzyB5jw();
     base();
     ValidationUtils.ArgumentNotNull(serializerReader, "serializerReader");
     this._serializerReader = serializerReader;
     this._serializer       = serializerReader.Serializer;
 }
Exemplo n.º 5
0
        public JsonFormatterConverter(JsonSerializerInternalReader reader, JsonISerializableContract contract, JsonProperty member)
        {
            ValidationUtils.ArgumentNotNull(reader, nameof(reader));
            ValidationUtils.ArgumentNotNull(contract, nameof(contract));

            _reader   = reader;
            _contract = contract;
            _member   = member;
        }
        internal virtual void PopulateInternal(JsonReader reader, object target)
        {
            ValidationUtils.ArgumentNotNull(reader, "reader");
              ValidationUtils.ArgumentNotNull(target, "target");

              JsonSerializerInternalReader serializerReader = new JsonSerializerInternalReader(this);
              serializerReader.Populate(reader, target);
        }
        internal virtual object DeserializeInternal(JsonReader reader, Type objectType)
        {
            ValidationUtils.ArgumentNotNull(reader, "reader");

              JsonSerializerInternalReader serializerReader = new JsonSerializerInternalReader(this);
              return serializerReader.Deserialize(reader, objectType);
        }
 public JsonSerializerProxy(JsonSerializerInternalReader serializerReader)
 {
     ValidationUtils.ArgumentNotNull((object)serializerReader, nameof(serializerReader));
     this._serializerReader = serializerReader;
     this._serializer       = serializerReader.Serializer;
 }
	private object ReadObject(JsonReader reader, JsonSerializer serializer)
    {
      IDictionary<string, object> expandoObject = new ExpandoObject();

      while (reader.Read())
      {
        switch (reader.TokenType)
        {
          case JsonToken.PropertyName:
			string propertyName = reader.Value.ToString();
			if (!reader.Read())
			  throw new Exception("Unexpected end.");

			object v = ReadValue(reader, serializer);

			if (propertyName == "$type")
			{
			  //Assume that this is always the first property

			  Type objectType = null;
			  objectType = ((string)v).StartsWith("System.Dynamic.ExpandoObject,")
				  ? typeof(ExpandoObject)
				  : Type.GetType((string)v, true);

			  if (objectType != typeof(ExpandoObject))
			  {
				if (!reader.Read())
					throw new Exception("Unexpected end.");

			  	var jsonSerializerInternalReader = new JsonSerializerInternalReader(serializer);
			  	var expandoTypedObject = jsonSerializerInternalReader.Deserialize(reader, objectType);

			  	return expandoTypedObject;
			  }
			}
			else
			{
				expandoObject[propertyName] = v;
			}

        	break;
          case JsonToken.Comment:
            break;
          case JsonToken.EndObject:
            return expandoObject;
        }
      }

      throw JsonSerializationException.Create(reader, "Unexpected end when reading ExpandoObject.");
    }