Help needed to generate JSON doc out of random text

I will have text (See INPUT) from aws textract which is extracted from pdf containing both printed and Handwritten text. I want to provide a json schema and want ai to create json like below.
Below OUTPUT (See OUTPUT) is what i got from CHAT GPT. I m super new to AI and ML but good experience in backend(go, python) and Cloud (esp AWS) devicePixelRatio.
So wanted to see what model to use and what to use cost effictively to achieve this. Any help is appreciated. Also i am looking for you to design entire thing for me just give me enough pointers so i can test move forward right now i a lost looking into models :smiley: .


INPUT

Text: StudentName, TextType: PRINTED, Confidence: 99.80887603759766
Text: Emily Johnson, TextType: HANDWRITING, Confidence: 99.80887603759766

many lines for one student and teacher with grades


OUTPUT

{
“students”: [
{
“key”: “StudentName”,
“value”: “Emily Johnson”,
“texttype”: “PRINTED”,
“confidence”: 99.98583984375
},
{
“key”: “StudentID”,
“value”: “S123456”,
“texttype”: “PRINTED”,
“confidence”: 99.91234588623047
},
{
“key”: “PhoneNumber”,
“value”: “555-987-6543”,
“texttype”: “PRINTED”,
“confidence”: 99.87655639648438
}
],
“teachers”: [
{
“key”: “TeacherName”,
“value”: “Dr. James Smith”,
“texttype”: “PRINTED”,
“confidence”: 99.94583129882812
},
{
“key”: “TeacherID”,
“value”: “T654321”,
“texttype”: “PRINTED”,
“confidence”: 99.94583129882812
},
{
“key”: “TeacherPhoneNumber”,
“value”: “555-321-7654”,
“texttype”: “PRINTED”,
“confidence”: 99.94583129882812
},
{
“key”: “Subject”,
“value”: “Mathematics”,
“texttype”: “PRINTED”,
“confidence”: 99.94583129882812
},
{
“key”: “YearsOfExperience”,
“value”: “10”,
“texttype”: “PRINTED”,
“confidence”: 99.94583129882812
}
],
“grades”: [
{
“key”: “Grade1”,
“value”: “A”,
“texttype”: “PRINTED”,
“confidence”: 99.98583984375
},
{
“key”: “Grade2”,
“value”: “B+”,
“texttype”: “PRINTED”,
“confidence”: 99.91234588623047
},
{
“key”: “Grade3”,
“value”: “A-”,
“texttype”: “PRINTED”,
“confidence”: 99.87655639648438
},
{
“key”: “GradeGiven”,
“value”: “A”,
“texttype”: “PRINTED”,
“confidence”: 99.94583129882812
}
]
}

hi @Suhrit
I hope Structured Data Extraction - LlamaIndex will help you.

Thank you @mahmutc for guidance will take a look at it and post my observation/results/blockers (if any).