示例#1
0
        private object DeserializeInternal(int depth)
        {
            if (++depth > this._depthLimit)
            {
                throw new ArgumentException();//this._s.GetDebugString(AtlasWeb.JSON_DepthLimitExceeded));
            }
            char?nextNonEmptyChar = this._s.GetNextNonEmptyChar();

            if (!nextNonEmptyChar.HasValue)
            {
                return(null);
            }
            this._s.MovePrev();
            if (this.IsNextElementDateTime())
            {
                return(this.DeserializeStringIntoDateTime());
            }
            if (IsNextElementObject(nextNonEmptyChar))
            {
                IDictionary <string, object> o = this.DeserializeDictionary(depth);
                if (o.ContainsKey("__type"))
                {
                    return(ObjectConverter.ConvertObjectToType(o, null, this._serializer));
                }
                return(o);
            }
            if (IsNextElementArray(nextNonEmptyChar))
            {
                return(this.DeserializeList(depth));
            }
            if (IsNextElementString(nextNonEmptyChar))
            {
                return(this.DeserializeString());
            }
            return(this.DeserializePrimitiveObject());
        }
示例#2
0
 public T ConvertToType <T>(object obj)
 {
     return((T)ObjectConverter.ConvertObjectToType(obj, typeof(T), this));
 }