如何将复杂的嵌套JavaScript对象存储到mysql?

时间:2019-05-18 20:58:33

标签: javascript mysql

将这种Javascript对象存储到MySQL并在将来可以编辑其内容的最佳方法是什么?我在下面插入了一些对象数组代码。该列表包含多个学习程序和子程序,示例中的一个是“ MIT”学习程序,其子组称为“ MIT 1-1”,在主文件中,我有更多的学习程序和子组。每个子组都包含实验室工作,讲座和考试阵列,它们全部在一周中有不同的几天,并且每个工作日中都为他们分配了讲座/实验室工作/考试。

[
    {
      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: []
      }
    }
  ]

0 个答案:

没有答案