【发布时间】:2019-06-14 02:44:20
【问题描述】:
我在Python Flask 中有一个简单的JSON 数组,就像这样..
response = [{
"success" : true,
"sessionid" : "sdf3452",
"border" : {
"top" : "452",
"left" : "454",
}
}]
js = json.dumps(response)
resp = Response(js, status=200, mimetype='application/json')
return resp
当我尝试这个时,我收到一个错误,抱怨真实值不存在......
NameError: name 'true' is not defined
知道为什么我不能返回布尔值 true 吗?
【问题讨论】:
-
你拥有的不是 JSON 数组。它是 Python 源代码。 Python中没有
true。