3

What is the best way to store this kind of Javascript object to MySQL with the option to edit it's contents in the future? I've inserted some of the object array code below. The list contains multiple study programmes and subroups, the one in the example is "MIT" study programme and its subgroup is called "MIT 1-1", in the main file I have many more study programmes and also subgroups. Each of the subgroups contain lab works, lectures and exams arrays, all of which inside of them have different days of the week and each of the week days have assigned lectures/lab works/exams to them.

[
    {
      studyProgramme: "MIT",
      subgroup: "MIT 1-1",
      course: 1,
      labWorks: {
        monday: [
          {
            title: "Program Engineering",
            classroom: "502a.",
            start: "1995-12-17T15:00:00",
            end: "1995-12-17T15:45:00",
            type: "Lab Work"
          },
                    {
            title: "Information System Security",
            classroom: "118a.",
            start: "1995-12-17T16:15:00",
            end: "1995-12-17T18:00:00",
            type: "Lab Work"
          }
        ],
        tuesday: [],
        wednesday: [],
        thursday: [],
        friday: []
      },
      lectures: {
        monday: [
          {
            title: "Audiovisual Art",
            classroom: "228a.",
            start: "1995-12-17T13:00:00",
            end: "1995-12-17T14:30:00",
            type: "Lecture"
          }
        ],
        tuesday: [],
        wednesday: [],
        thursday: [],
        friday: []
      },
      exams : {
        monday: [
          {
            title: "Philosophy",
            classroom: "101a.",
            start: "1995-12-17T08:30:00",
            end: "1995-12-17T11:00:00",
            type: "Exam"
          }
        ],
        tuesday: [],
        wednesday: [],
        thursday: [],
        friday: []
      }
    }
  ]
3
  • Can't you just store it as plain text? Commented May 18, 2019 at 20:59
  • 3
    JSON.stringify()? or perhaps dev.mysql.com/doc/refman/8.0/en/json.html Commented May 18, 2019 at 21:05
  • @JohnConde Will I still be able to retrieve it in the same structure as I stored it and also will the editing ability of each and every single lecture parameter won't be lost? Commented May 18, 2019 at 21:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.