@@ -352,7 +352,7 @@ def to_json(
352
352
exclude_none : bool = False ,
353
353
round_trip : bool = False ,
354
354
timedelta_mode : Literal ['iso8601' , 'float' ] = 'iso8601' ,
355
- bytes_mode : Literal ['utf8' , 'base64' ] = 'utf8' ,
355
+ bytes_mode : Literal ['utf8' , 'base64' , 'hex' ] = 'utf8' ,
356
356
inf_nan_mode : Literal ['null' , 'constants' , 'strings' ] = 'constants' ,
357
357
serialize_unknown : bool = False ,
358
358
fallback : Callable [[Any ], Any ] | None = None ,
@@ -373,7 +373,7 @@ def to_json(
373
373
exclude_none: Whether to exclude fields that have a value of `None`.
374
374
round_trip: Whether to enable serialization and validation round-trip support.
375
375
timedelta_mode: How to serialize `timedelta` objects, either `'iso8601'` or `'float'`.
376
- bytes_mode: How to serialize `bytes` objects, either `'utf8'` or `'base64 '`.
376
+ bytes_mode: How to serialize `bytes` objects, either `'utf8'`, `'base64'`, or `'hex '`.
377
377
inf_nan_mode: How to serialize `Infinity`, `-Infinity` and `NaN` values, either `'null'`, `'constants'`, or `'strings'`.
378
378
serialize_unknown: Attempt to serialize unknown types, `str(value)` will be used, if that fails
379
379
`"<Unserializable {value_type} object>"` will be used.
@@ -427,7 +427,7 @@ def to_jsonable_python(
427
427
exclude_none : bool = False ,
428
428
round_trip : bool = False ,
429
429
timedelta_mode : Literal ['iso8601' , 'float' ] = 'iso8601' ,
430
- bytes_mode : Literal ['utf8' , 'base64' ] = 'utf8' ,
430
+ bytes_mode : Literal ['utf8' , 'base64' , 'hex' ] = 'utf8' ,
431
431
inf_nan_mode : Literal ['null' , 'constants' , 'strings' ] = 'constants' ,
432
432
serialize_unknown : bool = False ,
433
433
fallback : Callable [[Any ], Any ] | None = None ,
@@ -448,7 +448,7 @@ def to_jsonable_python(
448
448
exclude_none: Whether to exclude fields that have a value of `None`.
449
449
round_trip: Whether to enable serialization and validation round-trip support.
450
450
timedelta_mode: How to serialize `timedelta` objects, either `'iso8601'` or `'float'`.
451
- bytes_mode: How to serialize `bytes` objects, either `'utf8'` or `'base64 '`.
451
+ bytes_mode: How to serialize `bytes` objects, either `'utf8'`, `'base64'`, or `'hex '`.
452
452
inf_nan_mode: How to serialize `Infinity`, `-Infinity` and `NaN` values, either `'null'`, `'constants'`, or `'strings'`.
453
453
serialize_unknown: Attempt to serialize unknown types, `str(value)` will be used, if that fails
454
454
`"<Unserializable {value_type} object>"` will be used.
0 commit comments