Beispiel #1
0
        public JsonContainer(Stream stream)
        {
            JsonContainer parsed = Parse(stream);

            ContainerType = parsed.ContainerType;
            container     = parsed.container;
        }
Beispiel #2
0
        private JsonContainer Build(ParseState parseMode, Queue <object> tokenStack)
        {
            JsonContainer container = new JsonContainer(parseMode == ParseState.Object ? ContainType.Object : ContainType.Array);

            int index = 0;

            while (tokenStack.Count > 0)
            {
                object key;
                if (parseMode == ParseState.Object)
                {
                    key = tokenStack.Dequeue();
                }
                else
                {
                    key = index++;
                }
                object value = tokenStack.Dequeue();
                container.Add(value, key);
            }

            return(container);
        }