Example #1
0
        private static BjSJsonArray ToJsonArray(IEnumerable array)
        {
            BjSJsonArray result = new BjSJsonArray();

            foreach (object obj in array)
            {
                result.Add(ToJsonValue(obj));
            }

            return(result);
        }
Example #2
0
        private static BjSJsonArray ToJsonObject(IDictionary dict)
        {
            BjSJsonArray result = new BjSJsonArray();

            IDictionaryEnumerator enu = dict.GetEnumerator();

            while (enu.MoveNext())
            {
                result.Add(new BjSJsonArray(ToJsonValue(enu.Key), ToJsonValue(enu.Value)));
            }

            return(result);
        }
Example #3
0
 public override void Process(char c)
 {
     if (c == ']')
     {
         _onDone(_curr);
     }
     else if (!_waitForSeperator)
     {
         _reader.State = new SelectValueState(_reader, this, obj =>
         {
             _reader.State = this;
             _curr.Add(obj);
             _waitForSeperator = true;
         });
         _reader.State.Process(c);
     }
     else if (c == ',')
     {
         _waitForSeperator = false;
     }
 }