Exemplo n.º 1
0
        private void Prefix()
        {
            if (this.needComma)
            {
                this.writer.Write(',');
            }

            if (this.currentKey == null)
            {
                return;
            }

            WriterState.WriteString(this.writer, this.currentKey);

            this.writer.Write(':');
            this.currentKey = null;
        }
Exemplo n.º 2
0
        public void Value(JSONValue value)
        {
            switch (value.Type)
            {
            case JSONType.Boolean:
                this.Prefix();
                this.writer.Write(value.Boolean ? "true" : "false");

                break;

            case JSONType.Number:
                this.Prefix();
                this.writer.Write(value.Number.ToString(CultureInfo.InvariantCulture));

                break;

            case JSONType.String:
                this.Prefix();
                WriterState.WriteString(this.writer, value.String);

                break;

            default:
                if (this.omitNull)
                {
                    this.currentKey = null;

                    return;
                }

                this.Prefix();
                this.writer.Write("null");

                break;
            }

            this.needComma = true;
        }