-5

var module = {
  "code": "6COM9051",
  "name": "More Web Scripting",
  "cohort": "IT/JH/ITMB",
  "students": {
    "97xx08xx01": {
      "firstName": "Jo 1",
      "lastName": "Bloggs",
      "allocatedGroup": "690511"
    },
    "97xx08xx03": {
      "firstName": "Jo 2",
      "lastName": "Bloggs",
      "allocatedGroup": "690511"
    },
    "97xx08xx02": {
      "firstName": "Jo 3",
      "lastName": "Bloggs",
      "allocatedGroup": "690513"
    },
    "97xx08xx06": {
      "firstName": "Joe 1",
      "lastName": "Bliggs",
      "allocatedGroup": "690513"
    },
    "97xx08xx05": {
      "firstName": "Joe 2",
      "lastName": "Bliggs",
      "allocatedGroup": "690511"
    },
    "97xx08xx04": {
      "firstName": "Joe 3",
      "lastName": "Bliggs",
      "allocatedGroup": "690513"
    },
  },
  "groups": {
    "690511": {
      "name": "Tutorial 1",
      "members": ["97xx08xx01", "97xx08xx05", "97xx08xx03"]
    },
    "690513": {
      "name": "Tutorial 2",
      "members": ["97xx08xx04", "97xx08xx02", "97xx08xx06"]
    }
  }
}
palaѕн
  • 72,112
  • 17
  • 116
  • 136
Humxa Moghal
  • 122
  • 11

1 Answers1

-1

You can just assign values,

modules.groups["<group key>"] = {
    "name": "Tutorial 123",
    "members": ["97xx08xx01", "97xx08xx05", "97xx08xx03"]
}

PS: I think you are new to stackoverflow. Though I answered this question, this type of questions are not encouraged in this community. How to add attributes to a JSON is a very basic thing which is explained in million tutorials, and probably answered here on stackoverflow probably years back. Do the homework before you ask for help.

Pubudu Dodangoda
  • 2,742
  • 2
  • 22
  • 38