[Python] How to fix my requests.Response in Python and convert it to JSON?

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using requests.get to return a response and I'm trying to convert the response to JSON. When I try to use

    json_data = json.loads(response.text)


    (also tried response.json()), it throws an error:

    Expecting value: line 1 column 1 (char 0)


    When I check the response.text, I notice that the first line says:

    OK:
    elelemt1: null
    element2: null
    element3: null


    Is it because the first line does not have a proper key:value pair as the others do?

    Continue reading...

Compartilhe esta Página