Spacy NER model results into a format of prodigy dataset jsonl format

Is there any script or a way where I can run my spacy NER model on few texts and get the output of the predicted entities in the below format for eg:

examples = [
    ("Trump says he's answered Mueller's Russia inquiry questions \u2013 live",{"entities":[[0,5,"PERSON"],[25,32,"PERSON"],[35,41,"GPE"]]}),
    ("Alexander Zverev reaches ATP Finals semis then reminds Lendl who is boss",{"entities":[[0,16,"PERSON"],[55,60,"PERSON"]]}),
    ("Britain's worst landlord to take nine years to pay off string of fines",{"entities":[[0,7,"GPE"]]}),
    ("Tom Watson: people's vote more likely given weakness of May's position",{"entities":[[0,10,"PERSON"],[56,59,"PERSON"]]}),
]

Or an output like the one we get in prodigy annotated dataset for example:
{"text":"nawaz sharif tum hanstay thay r tab imran khan roota tha ab wo hanstaha r tum rooty ho@kya yahi pakistan ha","_input_hash":459658641,"_task_hash":824993903,"tokens":[{"text":"nawaz","start":0,"end":5,"id":0},{"text":"sharif","start":6,"end":12,"id":1},{"text":"tum","start":13,"end":16,"id":2},{"text":"hanstay","start":17,"end":24,"id":3},{"text":"thay","start":25,"end":29,"id":4},{"text":"r","start":30,"end":31,"id":5},{"text":"tab","start":32,"end":35,"id":6},{"text":"imran","start":36,"end":41,"id":7},{"text":"khan","start":42,"end":46,"id":8},{"text":"roota","start":47,"end":52,"id":9},{"text":"tha","start":53,"end":56,"id":10},{"text":"ab","start":57,"end":59,"id":11},{"text":"wo","start":60,"end":62,"id":12},{"text":"hanstaha","start":63,"end":71,"id":13},{"text":"r","start":72,"end":73,"id":14},{"text":"tum","start":74,"end":77,"id":15},{"text":"rooty","start":78,"end":83,"id":16},{"text":"ho@kya","start":84,"end":90,"id":17},{"text":"yahi","start":91,"end":95,"id":18},{"text":"pakistan","start":96,"end":104,"id":19},{"text":"ha","start":105,"end":107,"id":20}],"spans":[{"start":0,"end":12,"token_start":0,"token_end":1,"label":"PERSON"},{"start":36,"end":46,"token_start":7,"token_end":8,"label":"PERSON"},{"start":96,"end":104,"token_start":19,"token_end":19,"label":"LOC"}],"answer":"accept"}

You could just write a script for that? Should be pretty straightforward: the doc.ents give you access to all entities in the document, and the Span object exposes attributes to let you access the entity start/end offsets, text and label. Also see the spaCy documentation: https://spacy.io/api/span#attributes