First of all, the reason for the error is the datetime type field when exporting JSON.
Added in the code:
class dateencoder (JSON. Jsoneencoder):
Default (self, obj):
if isinstance (obj, datetime. Datetime):
return obj.strftime (“% Y -% m -% DT% H:% m:% s”)
else:
return json.jsoneencoder.default (self, obj)
Then add a CLS = dateencoder
in json.dump to solve the problem
As shown in the figure:
no error will be reported
Read More:
- Type error: the JSON object must be STR, bytes or byte array, not ‘textiowrapper’
- Object is JSON, and JSON is converted to object
- Type error: object (…) is not a function
- Type error at XXX ‘set’ object is not reversible
- The JSON object is converted into a formdata object, and the formdata object is converted into a JSON object
- Springmvc Content type ‘application/json‘ not supported
- 【ipfs-api】npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
- TypeError: ‘numpy.int64′ object is not iterable ,’int’ object is not iterable
- [Solved] ERROR Error: No module factory availabl at Object.PROJECT_CONFIG_JSON_NOT_VALID_OR_NOT_EXIST ‘Error
- org.apache.spark.SparkException: Task not serializable
- Error type referred to is not an annotation type:RedisCache
- Error: (22,57) Java: type parameter… Mapper is not in the range of type variable M
- error TS2339:Property ‘length’ does not exist on type ‘object’
- Type error: cannot unpack non Iterable non type object appears when starting Bert server in Ubuntu system
- [Solved] RuntimeError: Expected object of scalar type Float but got scalar type Double for argument #2 ‘mat1‘
- Python json.dumps () json.dump The difference between ()
- Python 3 error typeerror: ‘dict’_ keys‘ object is not subscriptable
- “class“ object is not subscriptable
- The background object of thymeleaf is null, which solves the problem of error when the object is empty to get the property value
- Python error type error: ‘range’ object does not support item assignment, solution