Remove u' infront of my JSON data

前端 未结 1 1137
礼貌的吻别
礼貌的吻别 2021-01-14 14:14

I\'m new to python and it seems that all my JSON data is combined with u\' prefix as such:

{u\'number\': u\'12345666\', u\"items\"...}

I do

相关标签:
1条回答
  • 2021-01-14 14:44

    The problem is that you are converting a dictionary to a string (probably Mako does str(...) for you). But you should jsonify it, i.e.

    import json
    context = { 'data': json.dumps(getitems(self)) }
    
    0 讨论(0)
提交回复
热议问题