我是新的JOLT,我不知道它很多,我需要JOLT规范来转换我下面的JSON到CSV文件:
{
"bigRecords": [
{
"Records": {
"Name": "R1",
"Id": "1P02XV425KCASEZGQLB8LPQMF4ZXCUBCTA01",
"Type": "New",
"Area": "Eng",
"createdAt": "11-10-2022 06:10:00",
"deletedDate": "11-10-2022 06:20:00",
"deleted": true,
"deletedBy": "userId",
"createdBy": "userId"
},
"ancestors": [
{
"Name": "P1",
"Type": "DELETE",
"sta": "",
"some": "",
"Id": "1"
}
]
}, {
"Records": {
"Name": "R2",
"Id": "1P02XV425KCASEZGQLB8LPQMF4ZXCUBCTA01",
"Type": "DRAFT",
"Area": "Eng",
"createdAt": "11-10-2022 06:10:00",
"deletedDate": "11-10-2022 06:20:00",
"deleted": true,
"deletedBy": "userId",
"createdBy": "userId"
},
"dependentRecords": [
{
"Name": "P3",
"Type": "DELETE",
"sta": "1P0",
"some": "1P02",
"Id": "1P0"
}
]
}
]
}
请帮助我在转换复杂的json到CSV使用JOlT库,或任何其他方式,我可以做到这一点,在Spring Boot ?
2条答案
按热度按时间blmhpbnm1#
你有JsonFlatener,它很容易使用。https://github.com/wnameless/json-flattener
// {a.B=1,a.c=空,a.d[0]=假,a.d[1]=真,e=f,g=2.3}
gcxthw6b2#
库 * Josson * 具有
flatten()
函数。它还具有用于反转操作的函数unflatten()
。https://github.com/octomix/josson