JSON – ‘Expecting value: line 2 column 1 (char 1)’

  google-cloud-platform, python, python-3.x

I receive the following response from my own webservice

{
    "my_dict": {
        "dateOfService": "xxx",
        "trans_id": "urn:uuid:xxxxx",
        
    }
}

In my python, I am using the following line to convert my response from str to dict

self.__response_text = json.loads(json.dumps(response.text))

This works fine when i deploy my code in GCP cloud function, However, the same thing doesn’t work when I try to execute through postman. I receive the following Error.

"string indices must be integers"

But when I change the code like below, then it works fine in POSTMAN but it doesnt work when i deploy the same in GCP cloud function. I receive the Error mentioned in my question

 self.__response_text = json.loads(response.text)

Source: Python Questions

LEAVE A COMMENT