TypeError: Object of type WorkItem is not JSON serializable

前端 未结 2 1928
你的背包
你的背包 2021-01-25 22:23

I received this error after running the script below. I would like to create a json file through the result that is generated in this script. What can I do to correct this probl

2条回答
  •  一生所求
    2021-01-25 22:56

    The following produces a generator, which JSON can not serialize:

    work_items = (wit_client.get_work_item(int(result.id)) for result in results)
    

    You can instead make work_items a list, which JSON can serialize:

    work_items = [wit_client.get_work_item(int(result.id)) for result in results]
    

提交回复
热议问题