Exemplo n.º 1
0
        object ConvertObject(IJsonConverter converter, object value, Type sourceType)
        {
            var rt = converter.GetReversiveType(new JsonItem(String.Empty, value, false));

            if (value != null && rt != null && sourceType.Equals(value.GetType()) == false)
            {
                var c  = _manager.GetSerializationInfo(rt);
                var jt = Reflection.GetJsonDataType(rt);
                if (jt != JsonDataType.Undefined)
                {
                    value = c.DeserializeMethod(this, value, c);
                }
                else if (value is JsonDict)
                {
                    value = CreateObject((JsonDict)value, c, null);
                }
            }
            return(converter.DeserializationConvert(value));
        }
Exemplo n.º 2
0
        void ConvertObject(IJsonConverter converter, JsonItem ji, Type sourceType)
        {
            var rt = converter.GetReversiveType(ji);
            var xv = ji._Value;

            if (xv != null && rt != null && sourceType.Equals(xv.GetType()) == false)
            {
                var c  = _manager.GetReflectionCache(rt);
                var jt = Reflection.GetJsonDataType(rt);
                if (jt != JsonDataType.Undefined)
                {
                    xv = c.DeserializeMethod(this, xv, c);
                }
                else if (xv is JsonDict)
                {
                    xv = CreateObject((JsonDict)xv, c, null);
                }
            }
            ji._Value = xv;
            converter.DeserializationConvert(ji);
        }