Esempio n. 1
0
        public static T DeserializeObject <T>(string Json) where T : class, new()
        {
            Logger.Clear();
            var CharStream = new CharacterStream(Json);
            var Lexer      = new LexicalAnalyzer(CharStream);

            if (!Lexer.Analyzing())
            {
                return(null);
            }

            var Parser = new SyntaxAnalyzer(Lexer.GetTokenStream());

            if (!Parser.Analyzing())
            {
                return(null);
            }

            var JsonNode = Parser.GetJsonNode() as SyntaxObjectNode;

            return(ParseObjectFromNode(typeof(T), JsonNode) as T);
        }
Esempio n. 2
0
        public static JsonObject DeserializeJsonObject(string Json)
        {
            Logger.Clear();
            var CharStream = new CharacterStream(Json);
            var Lexer      = new LexicalAnalyzer(CharStream);

            if (!Lexer.Analyzing())
            {
                return(null);
            }

            var Parser = new SyntaxAnalyzer(Lexer.GetTokenStream());

            if (!Parser.Analyzing())
            {
                return(null);
            }

            var JsonNode = Parser.GetJsonNode() as SyntaxObjectNode;

            return(ParseJsonObjectFromNode(JsonNode));
        }