@@ -15,29 +15,39 @@ protected override JsonDictionaryContract CreateDictionaryContract(Type objectTy
1515 if ( key is string stringKey &&
1616 settings . TryGetScrubOrIgnoreByName ( stringKey , out var scrubOrIgnore ) )
1717 {
18- return ToInterceptResult ( scrubOrIgnore . Value ) ;
18+ return ToInterceptKeyValueResult ( scrubOrIgnore . Value ) ;
1919 }
2020
2121 if ( value is not null &&
2222 settings . TryGetScrubOrIgnoreByInstance ( value , out scrubOrIgnore ) )
2323 {
24- return ToInterceptResult ( scrubOrIgnore . Value ) ;
24+ return ToInterceptKeyValueResult ( scrubOrIgnore . Value ) ;
2525 }
2626
27- return InterceptResult . Default ;
27+ return KeyValueInterceptResult . Default ;
2828 } ;
2929
3030 return contract ;
3131 }
3232
33- static InterceptResult ToInterceptResult ( ScrubOrIgnore scrubOrIgnore )
33+ static KeyValueInterceptResult ToInterceptKeyValueResult ( ScrubOrIgnore scrubOrIgnore )
3434 {
3535 if ( scrubOrIgnore == ScrubOrIgnore . Ignore )
3636 {
37- return InterceptResult . Ignore ;
37+ return KeyValueInterceptResult . Ignore ;
3838 }
3939
40- return InterceptResult . Replace ( "{Scrubbed}" ) ;
40+ return KeyValueInterceptResult . ReplaceValue ( "{Scrubbed}" ) ;
41+ }
42+
43+ static ItemInterceptResult ToInterceptItemResult ( ScrubOrIgnore scrubOrIgnore )
44+ {
45+ if ( scrubOrIgnore == ScrubOrIgnore . Ignore )
46+ {
47+ return ItemInterceptResult . Ignore ;
48+ }
49+
50+ return ItemInterceptResult . Replace ( "{Scrubbed}" ) ;
4151 }
4252
4353 string ResolveDictionaryKey ( JsonDictionaryContract contract , string name , object original )
@@ -213,10 +223,10 @@ protected override JsonArrayContract CreateArrayContract(Type objectType)
213223 if ( item is not null &&
214224 settings . TryGetScrubOrIgnoreByInstance ( item , out var scrubOrIgnore ) )
215225 {
216- return ToInterceptResult ( scrubOrIgnore . Value ) ;
226+ return ToInterceptItemResult ( scrubOrIgnore . Value ) ;
217227 }
218228
219- return InterceptResult . Default ;
229+ return ItemInterceptResult . Default ;
220230 } ;
221231
222232 if ( contract . CollectionItemType != null &&
0 commit comments