【发布时间】:2021-12-22 12:13:41
【问题描述】:
我正在烧瓶中编写一个路由来发送这个响应,我需要在一个实线中发送这个 json 响应,但是当我发送这个 json 时(因为长度)在多行中发送
@app.route("/dashboard", methods= ['GET','POST'])
def index():
.
.
.
response = {"iDisplayStart":1,"iDisplayLength":10,
"iTotalRecords":2,"iTotalDisplayRecords":2,"data":data_ne}
return jsonify(results)
当我在下面发送这个 json 响应时返回
{
"iDisplayStart": 1,
"iDisplayLength": 10,
"iTotalRecords": 2,
"iTotalDisplayRecords": 2,
"data": [
{data_ne}]}
但我想像下面这样在单行中
{"iDisplayStart":1,"iDisplayLength":10,"iTotalRecords":2,"iTotalDisplayRecords":2,"data":data_ne}
有没有办法做到这一点?感谢您的考虑。
【问题讨论】:
-
为什么单行很重要?
-
@balderman 我不确切知道我尝试使用我不熟悉的代码(html、jQuery、ajax),并且我知道何时以单行代码发送响应工作
-
我认为它没有任何重要性..
-
@balderman 你是对的,我测试并且不再工作可能我更深入地研究代码并且一些不寻常的是当准确发送此响应但在''(字符串模式)下代码工作