如何在Python中将文本转换为dict列表



我有这样的文本结果:

{"title": "Less Payment", "outstanding": false, "content": [{"name": "Customer Payment: INV/2020/0002", "journal_name": "Cash", "amount": 50000.0, "currency": "Rp", "digits": [69, 2], "position": "before", "date": "2020-04-29", "payment_id": 13, "account_payment_id": 3, "payment_method_name": null, "move_id": 9, "ref": "CSH1/2020/0003 (INV/2020/0002)"}, {"name": "Customer Payment: INV/2020/0003", "journal_name": "Cash", "amount": 15000.0, "currency": "Rp", "digits": [69, 2], "position": "before", "date": "2020-04-29", "payment_id": 18, "account_payment_id": 4, "payment_method_name": null, "move_id": 11, "ref": "CSH1/2020/0004 (INV/2020/0003)"}]}

它看起来像字典,但实际上结果的数据类型是字符串。

我想把它转换成正确的格式,这样我就可以处理数据了。

如何做到。。?,或者任何关于这方面的教程或资料。。?

有关详细信息,我从Odoo13mail.template获得结果,然后我想从account.move对象的invoice_payments_widget字段获得结果。

import json
my_json_string = "{'hi':5}"
res = json.loads(my_json_string)
print(res['hi']) # 5
import json
x='{"title": "Less Payment", "outstanding": false, "content": [{"name": "Customer Payment: INV/2020/0002", "journal_name": "Cash", "amount": 50000.0, "currency": "Rp", "digits": [69, 2], "position": "before", "date": "2020-04-29", "payment_id": 13, "account_payment_id": 3, "payment_method_name": null, "move_id": 9, "ref": "CSH1/2020/0003 (INV/2020/0002)"}, {"name": "Customer Payment: INV/2020/0003", "journal_name": "Cash", "amount": 15000.0, "currency": "Rp", "digits": [69, 2], "position": "before", "date": "2020-04-29", "payment_id": 18, "account_payment_id": 4, "payment_method_name": null, "move_id": 11, "ref": "CSH1/2020/0004 (INV/2020/0003)"}]}'
x=json.loads(x)