public static void WriteToken(BionReader reader, JsonTextWriter writer) { switch (reader.TokenType) { case BionToken.StartObject: writer.WriteStartObject(); break; case BionToken.StartArray: writer.WriteStartArray(); break; case BionToken.EndObject: writer.WriteEndObject(); break; case BionToken.EndArray: writer.WriteEndArray(); break; case BionToken.PropertyName: writer.WritePropertyName(reader.CurrentString()); break; case BionToken.String: writer.WriteValue(reader.CurrentString()); break; case BionToken.Integer: writer.WriteValue(reader.CurrentInteger()); break; case BionToken.Float: writer.WriteValue(reader.CurrentFloat()); break; case BionToken.True: case BionToken.False: writer.WriteValue(reader.CurrentBool()); break; case BionToken.Null: writer.WriteNull(); break; default: throw new NotImplementedException($"BionToJson not implemented for {reader.TokenType} @{reader.BytesRead}."); } }