@@ -352,7 +352,7 @@ def to_json(
352352 exclude_none : bool = False ,
353353 round_trip : bool = False ,
354354 timedelta_mode : Literal ['iso8601' , 'float' ] = 'iso8601' ,
355- bytes_mode : Literal ['utf8' , 'base64' ] = 'utf8' ,
355+ bytes_mode : Literal ['utf8' , 'base64' , 'hex' ] = 'utf8' ,
356356 inf_nan_mode : Literal ['null' , 'constants' , 'strings' ] = 'constants' ,
357357 serialize_unknown : bool = False ,
358358 fallback : Callable [[Any ], Any ] | None = None ,
@@ -373,7 +373,7 @@ def to_json(
373373 exclude_none: Whether to exclude fields that have a value of `None`.
374374 round_trip: Whether to enable serialization and validation round-trip support.
375375 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 '`.
377377 inf_nan_mode: How to serialize `Infinity`, `-Infinity` and `NaN` values, either `'null'`, `'constants'`, or `'strings'`.
378378 serialize_unknown: Attempt to serialize unknown types, `str(value)` will be used, if that fails
379379 `"<Unserializable {value_type} object>"` will be used.
@@ -427,7 +427,7 @@ def to_jsonable_python(
427427 exclude_none : bool = False ,
428428 round_trip : bool = False ,
429429 timedelta_mode : Literal ['iso8601' , 'float' ] = 'iso8601' ,
430- bytes_mode : Literal ['utf8' , 'base64' ] = 'utf8' ,
430+ bytes_mode : Literal ['utf8' , 'base64' , 'hex' ] = 'utf8' ,
431431 inf_nan_mode : Literal ['null' , 'constants' , 'strings' ] = 'constants' ,
432432 serialize_unknown : bool = False ,
433433 fallback : Callable [[Any ], Any ] | None = None ,
@@ -448,7 +448,7 @@ def to_jsonable_python(
448448 exclude_none: Whether to exclude fields that have a value of `None`.
449449 round_trip: Whether to enable serialization and validation round-trip support.
450450 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 '`.
452452 inf_nan_mode: How to serialize `Infinity`, `-Infinity` and `NaN` values, either `'null'`, `'constants'`, or `'strings'`.
453453 serialize_unknown: Attempt to serialize unknown types, `str(value)` will be used, if that fails
454454 `"<Unserializable {value_type} object>"` will be used.
0 commit comments