【发布时间】:2020-08-14 23:25:25
【问题描述】:
{"books": {
"Harry Potter": {
"text": "There are several harry potter books:/n-Chamber of Secrets/n--chess/n--dog/n-Goblet of Fire/n--dragon/n--broomstick "
}
}
上面的 JSON 对象。我想将文本字段转换为以下内容
There are several harry potter books:
-Chamber of Secrets
--chess
--dog
-Goblet of Fire
--dragon
--broomstick
可以看到有一个标题,两个主题,两个子主题 我想将每个分成以下类型的 JSON 对象
{"books": {
"Harry Potter": {
"subject": "There are several harry potter books:",
"book 1" : {
"title": "-Chamber of Secrets",
"Contents 1" : "--chess",
"Contents 2" : "--dog"},
"book 2" : {
"title":"-Goblet of Fire",
"Contents 1" : "--dragon",
"Contents 2" : "--broomstick"}
}
}}
理想情况下,我希望能够动态地做到这一点。不同数量的书籍和书籍中的内容。我正在使用 NiFi JOLT Transform 对规范的任何帮助将不胜感激
【问题讨论】:
标签: json string apache-nifi jolt