我有以下JSON输出。我希望将输出按普通TZ分组。
输入:
{
"TZ": "5f105439-a0a7-4134-9e98-87553d434b35",
"TN": "4c4c4544-0046-3310-8056-b2c04f433432",
"TNN": "a2331"
}
{
"TZ": "5f105439-a0a7-4134-9e98-87553d434b35",
"TN": "4c4c4544-0030-5110-8051-b3c04f433432",
"TNN": "a2332"
}
{
"TZ": "5f105439-a0a7-4134-9e98-87553d434b35",
"TN": "4c4c4544-0030-5210-8054-b3c04f433432",
"TNN": "a2437"
}
{
"TZ": "5f105439-a0a7-4134-9e98-87553d434b35",
"TN": "4c4c4544-0030-5110-8052-b3c04f433432",
"TNN": "a2438"
}
{
"TZ": "5f105439-a0a7-4134-9e98-87553d434b35",
"TN": "4c4c4544-0030-5210-8050-b3c04f433432",
"TNN": "a2439"
}
{
"TZ": "5f105439-a0a7-4134-9e98-87553d434b35",
"TN": "4c4c4544-0046-3310-8053-b2c04f433432",
"TNN": "a2440"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-0046-3310-8056-b2c04f433432",
"TNN": "a2331"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-0030-5110-8051-b3c04f433432",
"TNN": "a2332"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-0030-5210-8054-b3c04f433432",
"TNN": "a2437"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-0030-5110-8052-b3c04f433432",
"TNN": "a2438"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-0030-5210-8050-b3c04f433432",
"TNN": "a2439"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-0046-3310-8053-b2c04f433432",
"TNN": "a2440"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-004a-3810-8050-b9c04f394e32",
"TNN": "d1814"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-004a-3710-8059-b9c04f4c4e32",
"TNN": "d1815"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-004a-3710-8058-b9c04f4c4e32",
"TNN": "d1816"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-004a-3810-8057-b9c04f4c4e32",
"TNN": "d1817"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "4c4c4544-004a-3710-8050-b9c04f394e32",
"TNN": "d1818"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "577d18d8-519e-11e9-a1e8-005056962661",
"TNN": "edg1"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "60971284-519e-11e9-9f28-00505696744e",
"TNN": "edg2"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "67f2aaa2-519e-11e9-a7ff-00505696f042",
"TNN": "edg3"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "711dc120-519e-11e9-ba09-005056965018",
"TNN": "edg4"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "7acbdc7a-519e-11e9-99c3-005056965c74",
"TNN": "edg5"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "82830f7e-519e-11e9-b1a5-00505696749d",
"TNN": "edg6"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "8ac12ffe-519e-11e9-8bf9-00505696d434",
"TNN": "edg7"
}
{
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
"TN": "943a9d40-519e-11e9-a918-00505696771c",
"TNN": "edg8"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "4c4c4544-004a-3810-8050-b9c04f394e32",
"TNN": "d1814"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "4c4c4544-004a-3710-8059-b9c04f4c4e32",
"TNN": "d1815"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "4c4c4544-004a-3710-8058-b9c04f4c4e32",
"TNN": "d1816"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "4c4c4544-004a-3810-8057-b9c04f4c4e32",
"TNN": "d1817"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "4c4c4544-004a-3710-8050-b9c04f394e32",
"TNN": "d1818"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "577d18d8-519e-11e9-a1e8-005056962661",
"TNN": "edg1"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "60971284-519e-11e9-9f28-00505696744e",
"TNN": "edg2"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "67f2aaa2-519e-11e9-a7ff-00505696f042",
"TNN": "edg3"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "711dc120-519e-11e9-ba09-005056965018",
"TNN": "edg4"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "7acbdc7a-519e-11e9-99c3-005056965c74",
"TNN": "edg5"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "82830f7e-519e-11e9-b1a5-00505696749d",
"TNN": "edg6"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "8ac12ffe-519e-11e9-8bf9-00505696d434",
"TNN": "edg7"
}
{
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
"TN": "943a9d40-519e-11e9-a918-00505696771c",
"TNN": "edg8"
}
预期输出:
[
"TZ": "5f105439-a0a7-4134-9e98-87553d434b35"
{
"TN": "4c4c4544-0046-3310-8056-b2c04f433432",
"TNN": "a2331"
}
{
"TN": "4c4c4544-0030-5110-8051-b3c04f433432",
"TNN": "a2332"
}
{
"TN": "4c4c4544-0030-5210-8054-b3c04f433432",
"TNN": "a2437"
}
{
"TN": "4c4c4544-0030-5110-8052-b3c04f433432",
"TNN": "a2438"
}
{
"TN": "4c4c4544-0030-5210-8050-b3c04f433432",
"TNN": "a2439"
}
{
"TN": "4c4c4544-0046-3310-8053-b2c04f433432",
"TNN": "a2440"
}
]
[
"TZ": "8dc3bff5-09b2-4518-81e8-39a8136f885f",
{
"TN": "4c4c4544-0046-3310-8056-b2c04f433432",
"TNN": "a2331"
}
{
"TN": "4c4c4544-0030-5110-8051-b3c04f433432",
"TNN": "a2332"
}
{
"TN": "4c4c4544-0030-5210-8054-b3c04f433432",
"TNN": "a2437"
}
{
"TN": "4c4c4544-0030-5110-8052-b3c04f433432",
"TNN": "a2438"
}
{
"TN": "4c4c4544-0030-5210-8050-b3c04f433432",
"TNN": "a2439"
}
{
"TN": "4c4c4544-0046-3310-8053-b2c04f433432",
"TNN": "a2440"
}
{
"TN": "4c4c4544-004a-3810-8050-b9c04f394e32",
"TNN": "d1814"
}
{
"TN": "4c4c4544-004a-3710-8059-b9c04f4c4e32",
"TNN": "d1815"
}
{
"TN": "4c4c4544-004a-3710-8058-b9c04f4c4e32",
"TNN": "d1816"
}
{
"TN": "4c4c4544-004a-3810-8057-b9c04f4c4e32",
"TNN": "d1817"
}
{
"TN": "4c4c4544-004a-3710-8050-b9c04f394e32",
"TNN": "d1818"
}
{
"TN": "577d18d8-519e-11e9-a1e8-005056962661",
"TNN": "edg1"
}
{
"TN": "60971284-519e-11e9-9f28-00505696744e",
"TNN": "edg2"
}
{
"TN": "67f2aaa2-519e-11e9-a7ff-00505696f042",
"TNN": "edg3"
}
{
"TN": "711dc120-519e-11e9-ba09-005056965018",
"TNN": "edg4"
}
{
"TN": "7acbdc7a-519e-11e9-99c3-005056965c74",
"TNN": "edg5"
}
{
"TN": "82830f7e-519e-11e9-b1a5-00505696749d",
"TNN": "edg6"
}
{
"TN": "8ac12ffe-519e-11e9-8bf9-00505696d434",
"TNN": "edg7"
}
{
"TN": "943a9d40-519e-11e9-a918-00505696771c",
"TNN": "edg8"
}
]
"TZ": "e1c4ad26-2b2b-41cf-b7be-155704018580",
{
"TN": "4c4c4544-004a-3810-8050-b9c04f394e32",
"TNN": "d1814"
}
{
"TN": "4c4c4544-004a-3710-8059-b9c04f4c4e32",
"TNN": "d1815"
}
{
"TN": "4c4c4544-004a-3710-8058-b9c04f4c4e32",
"TNN": "d1816"
}
{
"TN": "4c4c4544-004a-3810-8057-b9c04f4c4e32",
"TNN": "d1817"
}
{
"TN": "4c4c4544-004a-3710-8050-b9c04f394e32",
"TNN": "d1818"
}
{
"TN": "577d18d8-519e-11e9-a1e8-005056962661",
"TNN": "edg1"
}
{
"TN": "60971284-519e-11e9-9f28-00505696744e",
"TNN": "edg2"
}
{
"TN": "67f2aaa2-519e-11e9-a7ff-00505696f042",
"TNN": "edg3"
}
{
"TN": "711dc120-519e-11e9-ba09-005056965018",
"TNN": "edg4"
}
{
"TN": "7acbdc7a-519e-11e9-99c3-005056965c74",
"TNN": "edg5"
}
{
"TN": "82830f7e-519e-11e9-b1a5-00505696749d",
"TNN": "edg6"
}
{
"TN": "8ac12ffe-519e-11e9-8bf9-00505696d434",
"TNN": "edg7"
}
{
"TN": "943a9d40-519e-11e9-a918-00505696771c",
"TNN": "edg8"
}
我找不到一种通过group_by和map函数来实现此目的的方法。任何帮助将不胜感激。
答案 0 :(得分:0)