1
I am trying to work with data from an online database. I am able to do the requisitions in the right way. But when trying to convert the downloaded data using the bson package, I get a string object and not a json. I tried several ways to convert this string to json, but I couldn’t. How do I convert?
Thanks for your help.
from bson.json_util import dumps
.
.
.
dados = colecao.find_one()
ver_json = dumps(dados)
print(ver_json)
>>> '{"_id": {"$oid": "602e6c108a0e449623b9ffd6"}, "cidades": "Maceio", "longitude": 35.5878, "latitude": -9.0, "data": {"$date": 1613617200000}, "temperaturaAr": 25.1, "precipitacao": 2.0, "radiacao": 560.0, "velocidadeVento": 10.0, "direcaoVento": 234.0}'
type(ver_json)
>>> str