JSFiddle - React, Tailwind, and code Playground

HTML

<pre></pre>

JavaScript

$(function () {
    var doctorsData = getDoctors();
    var doctors = $.map(doctorsData.doctors, function (doc) {
        return new Doctor(doc.id, doc.username);
    });
    $('pre').text(JSON.stringify(doctors, null, '  '));
});


var Doctor = function(nameParam, usernameParam){
    this.name = nameParam;
    this.username = usernameParam;
}
    
function getDoctors() {
        return {
      "doctors": [
        {
          "id": 8,
          "schedules": [
            {
              "id": 8,
              "totime": "11:17",
              "dayId": 2,
              "location": "Somajiguda",
              "fromtime": "10:17",
              "hospitalId": 5,
              "day": "Tuesday",
              "hospital": "Yashoda"
            }
          ],
          "username": "d1",
          "degree": "DA(Anaesthesia)",
          "email": "[email protected]",
          "imagePath": "",
          "department": "Bio-Chemistry",
          "name": "d1",
          "userid": 51,
          "gender": "Male",
          "mobile": "1234567900"
        },
        {
          "id": 10,
          "schedules": [
            {
              "id": 10,
              "totime": "12:35",
              "dayId": 2,
              "location": "Somajiguda",
              "fromtime": "11:35",
              "hospitalId": 5,
              "day": "Tuesday",
              "hospital": "Yashoda"
            }
          ],
          "username": "d3",
          "degree": "BDS",
          "email": "[email protected]",
          "imagePath": "",
          "department": "Bio-Chemistry",
          "name": "d3",
          "userid": 56,
          "gender": "Male",
          "mobile": "1234567890"
        },
        {
          "id": 1,
          "schedules": [
            {
              "id": 1,
              "totime": "12:55",
              "dayId": 1,
              "location": "Somajiguda",
              "fromtime": "11:55",
              "hospitalId": 5,
              "day": "Monday",
              "hospital":...