how to append json in under json
hello
I have succeeded in creating JSON module.data = data; var namodule = name; var nameofmodule = { "id":id, "namodule": namodule, "pid":pid } module.data.push(nameofmodule); console.log(module);
but it's just missing {{formation, Module1, Cours1, Chaiptre1])
in the final i want this
{
id
:
"4"
,
namodule
:
"Module 1"
,
pid
:
"1",i
d
:
"7"
,
namcours
:
"Cours 1 "
,
pid
:
"4
,
id
:
"10"
,
namodule
:
"
Chaiptre 1"
,
pid
:
"7"
}
you will find attached here also diagram creates
- Object
- data: Array(4)
- 0: {id: "4", namodule: "↵Module 1↵ ", pid: "1"}
- 1: {id: "5", namodule: "↵ Module 2↵ ", pid: "1"}
- 2: {id: "7", namodule: "↵ Cours 1↵ ↵ ", pid: "4"}
- 3: {id: "10", namodule: "↵ Chaiptre 1↵ ↵ ", pid: "7"}
- length: 4
- __proto__: Array(0)
- exports: "4.9.98"
- __proto__: Object