Object is not JSON¶
Problem¶
I have made a request to my deployment which failed and in the logs I get the following error:
TypeError: Object of type x is not JSON
Solution¶
The problem is caused by the fact that UbiOps needs JSON serializable input and output, and the object type you are returning is not JSON serializable. Data types that are currently supported are:
- String
- Integer
- Double precision (float)
- File
- Array of strings
- Array of doubles
- Array of integers
To fix the issue you will need to alter your code in the deployment file so that the output returned falls within the allowed data types. For more information on how to convert common data types to one that is JSON serializable, see Deployment input & output.