示例#1
0
        private JSONValue ParseDict()
        {
            this.Next();
            this.SkipWs();
            Dictionary <string, JSONValue> dictionary = new Dictionary <string, JSONValue>();

            while (this.cur != '}')
            {
                JSONValue jsonvalue = this.ParseValue();
                if (!jsonvalue.IsString())
                {
                    throw new JSONParseException("Key not string type at " + this.PosMsg());
                }
                this.SkipWs();
                if (this.cur != ':')
                {
                    throw new JSONParseException("Missing dict entry delimiter ':' at " + this.PosMsg());
                }
                this.Next();
                dictionary.Add(jsonvalue.AsString(false), this.ParseValue());
                this.SkipWs();
                if (this.cur == ',')
                {
                    this.Next();
                    this.SkipWs();
                }
            }
            this.Next();
            return(new JSONValue(dictionary));
        }
示例#2
0
        public bool Copy(string key, ref string dest, bool allowCopyNull)
        {
            bool      flag;
            JSONValue jsonvalue = this.Get(key, out flag);

            if (flag && (!jsonvalue.IsNull() || allowCopyNull))
            {
                dest = ((!jsonvalue.IsNull()) ? jsonvalue.AsString(false) : null);
            }
            return(flag);
        }