[Python] Format JSON correctly

Discussão em 'Python' iniciado por Stack, Agosto 18, 2025.

  1. Stack

    Stack Membro Participativo

    I have this JSON, which when fed into online JSON formatter websites, says JSON data not accurate.

    {
    "Hospitals":[
    {
    "name":"Centre"
    "url":"www.example.com"
    },
    {
    "name":"jdbcd"
    "url":"www.example.net"
    }
    ]
    }


    I know the Correct JSON data is by putting comma at the end of name attribute

    {
    "Hospitals":[
    {
    "name":"Centre",
    "url":"www.example.com"
    },
    {
    "name":"jdbcd",
    "url":"www.example.net"
    }
    ]
    }


    But in actual I have a very huge data to format. How can i do this programmatically (because python's json.load(file.json) gives error) or any online resource(I checked top google results, none worked)

    Continue reading...

Compartilhe esta Página