public void Serialize(Item item)
        {
            for (; item.Type != ItemType.End; item = this.itemizer.NextItem())
            {
                switch (item.Type)
                {
                case ItemType.ArrayStart:
                case ItemType.ObjectStart:
                    this.WriteSeparator(item);
                    this.writer.Write((item.Type == ItemType.ArrayStart) ? '[' : '{');
                    this.PushIndent();

                    this.state.childCount++;
                    this.states.Push(this.state);
                    this.state.childCount = 0;
                    this.state.type       = (item.Type == ItemType.ArrayStart) ? StateType.Array : StateType.Object;
                    break;

                case ItemType.ArrayEnd:
                case ItemType.ObjectEnd:
                    this.PopIndent();
                    this.WriteIndent(item);
                    this.writer.Write((item.Type == ItemType.ArrayEnd) ? ']' : '}');
                    this.state = this.states.Pop();
                    break;

                case ItemType.Key:
                    this.WriteSeparator(item);
                    EncodingUtility.EncodeTokenAsString(this.itemizer.ValueToken, this.writer);
                    this.writer.Write(':');
                    break;

                case ItemType.Value:
                    this.WriteSeparator(item);
                    EncodingUtility.EncodeToken(this.itemizer.ValueToken, this.writer);
                    this.state.childCount++;
                    break;
                }
            }
        }