简体   繁体   中英

Flask and jsonify: Escaping characters

I have a flask view which returns some JSON formatted data:

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).

The problem is, the <user_id> gets escaped and appears as %3Cuser_id%3E . Is there a way to stop the characters getting escaped?

Thanks to Martijn. I'm using url_for to build the URLs, and its doing the escaping.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM