У меня есть 14 простых объектов json, и я хочу сформировать один вложенный вывод json
Ввод:
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "sixth",
"Student name": "Rob",
"Subject": "botany"
}
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "sixth",
"Student name": "Rob",
"Subject": "zoology"
}
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "sixth",
"Student name": "kevin",
"Subject": "botany"
}
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "sixth",
"Student name": "kevin",
"Subject": "botany"
}
{
"School": "Happy",
"Teacher": "Petter",
"grade": "sixth",
"Student name": "tim",
"Subject": "botany"
}
{
"School": "Happy",
"Teacher": "Petter",
"grade": "sixth",
"Student name": "tim",
"Subject": "zoology"
}
{
"School": "Happy",
"Teacher": "Petter",
"grade": "sixth",
"Student name": "david",
"Subject": "botany"
}
{
"School": "Happy",
"Teacher": "Petter",
"grade": "sixth",
"Student name": "david",
"Subject": "zoology"
}
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "seventh",
"Student name": "jane",
"Subject": "math"
}
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "seventh",
"Student name": "Lin",
"Subject": "physics"
}
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "seventh",
"Student name": "jane",
"Subject": "math"
}
{
"School": "Happy",
"Teacher": "Mellisa",
"grade": "seventh",
"Student name": "Lin",
"Subject": "physics"
}
{
"School": "Happy",
"Teacher": "Petter",
"grade": "seventh",
"Student name": "jane",
"Subject": "math"
}
{
"School": "Happy",
"Teacher": "Petter",
"grade": "seventh",
"Student name": "Lin",
"Subject": "physics"
}
Вывод:
{
"School": "Happy",
"Teacher": [
{
"name": "petter",
"Student": [
{
"name": "Lin",
"grade":"seventh",
"Subject": [
{
"name": "physics"
},
{
"name": "math"
}
]
},
{
"name": "Jane",
"grade":"seventh",
"Subject": [
{
"name": "physics"
},
{
"name": "math"
}
]
}
]
}
]
}