@@ -46,14 +46,14 @@ function dataSerialize(data?: any, wrapPrimitives?: boolean) {
4646 }
4747
4848 if ( Array . isArray ( data ) ) {
49- return NSArray . arrayWithArray ( ( data as any ) . map ( dataSerialize ) ) ;
49+ return NSArray . arrayWithArray ( data . map ( ( el ) => dataSerialize ( el , wrapPrimitives ) ) . filter ( ( el ) => el !== null ) ) ;
5050 }
5151
52- const node = { } as any ;
53- Object . keys ( data ) . forEach ( function ( key ) {
54- const value = data [ key ] ;
55- node [ key ] = dataSerialize ( value , wrapPrimitives ) ;
56- } ) ;
52+ const node = Object . fromEntries (
53+ Object . entries ( data )
54+ . map ( ( [ key , value ] ) => [ key , dataSerialize ( value , wrapPrimitives ) ] )
55+ . filter ( ( [ , value ] ) => value !== null )
56+ ) ;
5757 return NSDictionary . dictionaryWithDictionary ( node ) ;
5858 }
5959
@@ -344,7 +344,7 @@ export namespace NATIVE {
344344 delete toPassOptions [ k ] ;
345345 }
346346 } ) ;
347- const mutDict = NSMutableDictionary . alloc ( ) . initWithDictionary ( dataSerialize ( toPassOptions ) as any ) ;
347+ const mutDict = NSMutableDictionary . alloc ( ) . initWithDictionary ( dataSerialize ( toPassOptions , true ) ) ;
348348
349349 nSentryOptions = SentryOptions . alloc ( ) . initWithDictDidFailWithError ( mutDict as any ) ;
350350
@@ -386,7 +386,7 @@ export namespace NATIVE {
386386 if ( beforeBreadcrumb ) {
387387 const deserialized = dictToJSON ( breadcrumb . serialize ( ) ) ;
388388 const processed = beforeBreadcrumb ( deserialized , null ) ;
389- const serialized = dataSerialize ( processed ) as NSDictionary < string , any > ;
389+ const serialized = dataSerialize ( processed , true ) as NSDictionary < string , any > ;
390390 const levels = [ 'log' , 'debug' , 'info' , 'warning' , 'error' , 'fatal' ] ;
391391
392392 if ( processed ) {
0 commit comments