【发布时间】:2021-02-03 10:57:10
【问题描述】:
我正在测试我编写的输出 JSON 的 python 刮板。 JSON 中的一些变量暂时为空,稍后将在数据库中进行操作。所以,我需要将它们声明为空。但是在尝试将 JSON 放入 Postman 并将其发送到数据库时出现错误。
我正在运行我的爬虫,从其输出中复制一个示例 JSON 对象,将其粘贴到 Postman 帖子的正文中,并将 Content-Type 设置为 application/json,然后将其发送到 Mongo 上的测试数据库.
我尝试过的事情和结果:
variableName = ""
Error: 500 Internal Server Error Object reference not set to an instance of an object.
(我的谷歌搜索告诉我这个错误意味着'你正在尝试使用一个空对象,就好像它是一个正确引用的对象'。)
variableName = null
Error: 500 Internal Server Error Object reference not set to an instance of an object.
variableName = None
将值更改为 None 会导致 JSON 输出单词 null ,然后给出与上述相同的错误。
我该如何解决这个错误?
【问题讨论】:
-
请分享您的完整请求。