Firstly, I’m completely new to JSON and JavaScript so I apologise if I’m missing something obvious. And sorry if I’m using the wrong terminology…
I have a JSON array, which is all lumped together in column of table data called MEDICAL_DATA, which may contain any amount of groups of pairs (sample below shows five pair groups)… and some groups of pairs may not contain all the information (for example, not all the pairs in the below example have Documentation).
What I would like to do is work out how I would show this data in HTML. I’ve worked out how to show ONE group but I have no idea how to have it show all the groups because I don’t know how many groups there would be. And I don’t know what to do when there is no Documentation pair included.
Would really appreciate any help. Yes, there is the issue with the Date pair showing all that rubbish after the T, too, but I’ll get to that later LOL.
{“Date”:“2024-09-09T02:00:00.000Z”,“Practitioner”:“Bobbie Forrest”,“Reason”:“Worming”,“Details”:“Worming table given by foster carer”}, {“Date”:“2024-09-16T02:00:00.000Z”,“Practitioner”:“Bobbie Forrest”,“Reason”:“Worming”,“Details”:“Worming tablet given by foster carer”}, {“Date”:“2024-09-22T02:00:00.000Z”,“Practitioner”:“Lance Peters”,“Reason”:“Vax - First”,“Documentation”:“https://certificate01.jpg”}, {“Date”:“2024-09-22T02:00:00.000Z”,“Practitioner”:“Lance Peters”,“Reason”:“Microchip”}, {“Date”:“2024-09-22T02:00:00.000Z”,“Practitioner”:“Lance Peters”,“Reason”:“Desex”,“Documentation”:“https://certificate02.jpg”}
Basically the JSON information is all popped in one column of a table for each cat so (as it pulls the data from the medical table relevant for the cat and plonks it in a column in JSON format in the cat table. So I can display all the JSON data but basically in the format that it looks now.
Ideally what I would like to achieve if pointed in the right direction (and if in my skill range which is basic) is to have it look in the JSON array and display what is essentially five columns (date, practitioner, reason, details and documentation) in a table format BUT I don’t know how to a) have it realise that the group is within the curly brackets and b) show all the groups regardless of how many there are. I assume some sort of loop that keeps looking until there is no more?
Sorry if this doesn’t make sense but I’m trying to describe it as best as I can and i’m not sure of the correct terminology. But I’m keen to give it a try.
Yep, that’s what I’m keen to show. Thanks for the tips. I will give it a red hot go! Its the parsing of the JSON array and looping I’ve no idea about how to go about but now I know that terminology, I will google.