Class DefaultSerializer (2.0.0)
Stay organized with collections
Save and categorize content based on your preferences.
Default serializer for serialization and deserialization for prediction.
Methods
deserialize(data: typing.Any, content_type: typing.Optional[str]) -> typing.Any
Deserializes the request data. Invoked before predict.
| Parameters |
| Name |
Description |
data |
Any
Required. The request data sent to the application.
|
content_type |
str
Optional. The specified content type of the request.
|
| Exceptions |
| Type |
Description |
HTTPException |
If Json deserialization failed or the specified content type is not supported. |
serialize(prediction: typing.Any, accept: typing.Optional[str]) -> typing.Any
Serializes the prediction results. Invoked after predict.
| Parameters |
| Name |
Description |
prediction |
Any
Required. The generated prediction to be sent back to clients.
|
accept |
str
Optional. The specified content type of the response.
|
| Exceptions |
| Type |
Description |
HTTPException |
If Json serialization failed or the specified accept is not supported. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-08-01 UTC.
[null,null,["Last updated 2026-08-01 UTC."],[],[]]