Reputation: 4348
I'm using requests module in order to interact with an API:
response = requests.get(<URL>)
my_dict = response.json()
my_dict
var looks something like this (I've simplified the dict) :
{'annotations': 'list'}
The problem is that the response doesn't pass the json linter due to Expecting 'STRING', got 'undefined'
, I'm assuming that it single quote '
generates this problem .
Any ideas how to fix this ?
UPDATE:
Grafana upload (actually I'm using the API, but the result is the same GUI or API)
Also jsonlint throws the same error: https://jsonlint.com/
Upvotes: 0
Views: 613
Reputation: 191874
response.json()
actually parses the response. Since that returns successfully, you already know it's valid JSON. If it weren't valid, you'd have to fix the code of the API your accessing
If you only want the JSON response body, use response.text
Upvotes: 1