After a post request with data at a site
f = urllib.request.urlopen(request,data)
I get back a response and after
res = f.responce.read().decode()
I get a type type(res) <class string>
that prints like:
[
{
"example": "174 55",
"example": "example",
"example": "example",
"example": "",
"example": false,
"example": null,
},
{
"example": "174 55",
"example": "example",
"example": "example",
"example": "",
"example": false,
"example": null,
}
]
Is there a way to get it immediately as a list of dicts, or an easy way to transform it to a list of dicts?
This is json data.
Use the built-in json
module:
import json
...
res = f.responce.read().decode()
data = json.loads(res)