Example #1
0
        public static T Deserialize <T>(string json, string fieldPrefix)
        {
            if (ScalarDeserializer.IsScalar(typeof(T)))
            {
                return(ScalarDeserializer.Deserialize <T>(json));
            }

            using (StringReader sr = new StringReader(json))
            {
                using (JsonReader reader = new JsonReader(sr))
                {
                    return(JsonDeserializer.Deserialize <T>(reader, fieldPrefix));
                }
            }
        }
Example #2
0
        public static object Deserialize(string json, System.Type type)
        {
            if (ScalarDeserializer.IsScalar(type))
            {
                return(ScalarDeserializer.Deserialize(json, type));
            }

            using (StringReader sr = new StringReader(json))
            {
                using (JsonReader reader = new JsonReader(sr))
                {
                    return(JsonDeserializer.Deserialize(reader, type));
                }
            }
        }