Changing The Format Of Json File Using String Maniputlation

I have a JSON file that looks something like this:

"{""audio_filepath"": ""/content/drive/MyDrive/nemo_commonvoice/wav_files/wav_train/sample-000001.wav"", ""duration"": 2.232, ""text"": ""it took her a while to get used to it""}"

I want the extra " to be removed from each of the lines so that my output looks something like this: - The original JSON format

{"audio_filepath": "/content/drive/MyDrive/nemo_commonvoice/wav_files/wav_train/sample-000001.wav", "duration": 2.232, "text": "it took her a while to get used to it"}

I require a function that can do the string manipulation for me or at least some hint on how to fix it.

For my function which parses the entire JSON file is:

def create_manifest(data: List[tuple], output_name: str, manifest_path: str):

"Takes in the data, which is a tsv file and parses its columns to create a JSON file"

    output_file = Path(manifest_path)/output_name
    output_file.parent.mkdir(exist_ok=True, parents=True)

    with'w') as f:
        for wav_path,duration,text in tqdm(data,total=len(data)):
                    'audio_filepath': wav_path,
                    "duration": duration,
                    'text': text
                }) + '\n'

Any help will be beneficial.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum