public override void Write( Utf8JsonWriter writer, RequestArgs value, JsonSerializerOptions options) { writer.WriteStartObject(); foreach (var kvp in value.GetType().GetProperties()) { var prop = value.GetType().GetProperty(kvp.Name).GetValue(value); if (prop == null) { continue; } var propType = value.GetType().GetProperty(kvp.Name).PropertyType; if (propType == typeof(bool)) { writer.WriteBoolean(kvp.Name.ToCamelCase(), (bool)prop); } else { writer.WriteString(kvp.Name.ToCamelCase(), (string)prop); } } writer.WriteEndObject(); }
public abstract void Write( Utf8JsonWriter writer, RequestArgs value, JsonSerializerOptions options );