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"]
}
}
}
Asked
Active
Viewed 34 times
-5

palaѕн
- 72,112
- 17
- 116
- 136

Humxa Moghal
- 122
- 11
-
2Please format your code and ask a question. – Rob Monhemius Dec 31 '17 at 16:09
-
2Welcome to StackOverflow. Please see the [How to Ask](https://stackoverflow.com/help/how-to-ask) page for help clarifying this question. – palaѕн Dec 31 '17 at 16:09
-
Actually i want to add new group in Above json – Humxa Moghal Dec 31 '17 at 16:11
-
Possible duplicate of [Add new attribute (element) to JSON object using JavaScript](https://stackoverflow.com/questions/736590/add-new-attribute-element-to-json-object-using-javascript) – Pubudu Dodangoda Jan 01 '18 at 02:29
1 Answers
-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