public static void WriteToken(JsonTextReader reader, BionWriter writer) { switch (reader.TokenType) { case JsonToken.StartObject: writer.WriteStartObject(); break; case JsonToken.StartArray: writer.WriteStartArray(); break; case JsonToken.EndObject: writer.WriteEndObject(); break; case JsonToken.EndArray: writer.WriteEndArray(); break; case JsonToken.PropertyName: writer.WritePropertyName((string)reader.Value); break; case JsonToken.String: string value = (string)reader.Value; writer.WriteValue(value); break; case JsonToken.Integer: writer.WriteValue((long)reader.Value); break; case JsonToken.Boolean: writer.WriteValue((bool)reader.Value); break; case JsonToken.Null: writer.WriteNull(); break; case JsonToken.Float: writer.WriteValue((double)reader.Value); break; case JsonToken.Date: writer.WriteValue(((DateTime)reader.Value).ToString("yyyy-MM-ddThh:mm:ss.FFFFFFFZ")); break; case JsonToken.Comment: // Nothing Written break; default: throw new NotImplementedException($"JsonToBion not implemented for {reader.TokenType} @({reader.LineNumber}, {reader.LinePosition})."); } }
public override void WriteEndObject() { _writer.WriteEndObject(); }