[英]Flask and jsonify: Escaping characters
I have a flask view which returns some JSON formatted data: 我有一个flask视图,它返回一些JSON格式的数据:
def myview():
entities = get_my_entities()
return jsonify({'entities': entities})
entities if a list of dictionaries; 实体(如果有字典列表); in each dictionary there is a value like http://example.com/get/<user_id>/12345678 where <user_id> is a placeholder where the user should insert an indentifier that that have been given (and which should not appear in the JSON result).
在每本字典中,都有一个类似http://example.com/get/<user_id>/12345678的值,其中<user_id>是一个占位符,用户应在该占位符中插入一个已给出的标识符(该标识符不应出现在JSON结果)。
The problem is, the <user_id> gets escaped and appears as %3Cuser_id%3E . 问题是, <user_id>被转义并显示为%3Cuser_id%3E 。 Is there a way to stop the characters getting escaped?
有没有办法阻止角色逃脱?
Thanks to Martijn. 感谢Martijn。 I'm using url_for to build the URLs, and its doing the escaping.
我正在使用url_for构建URL,并进行转义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.