简体   繁体   English

使用 Jolt NIFI 将 JSON 转换为 JSON?

[英]JSON to JSON Transformation using Jolt NIFI?

`I have the following input json format and need to convert the below json file.Iam using jolt transformation but not able to properly format the output Iam using https://jolt-demo.appspot.com/#inception website `我有以下输入 json 格式,需要转换以下 json 文件。我使用 jolt 转换但无法正确格式化输出 Iam 使用https://jolt-demo.appspot.com/#inception网站

{
  "School": {
    "Data": {
      "Id": "",
      "Time": "",
      "Txs": "",
      "Pty": {
        "Name": "",
        "Number": {
          "OID": {
            "REM": {
              "sequenced": ""
            }
          }
        }
      }
    },
    "Facebook": [
      {
        "fid": {
          "fedit": "",
          "fcopy": ""
        },
        "Details": "Further details",
        "FBData": {
          "Flp": {
            "Fst": {
              "foo": "bar"
            }
          }
        }
      }
    ]
  }
}

`Need the following output json format using JOLT Iam trying to convert using the jolt transformation `需要使用 JOLT 的以下输出 json 格式我正在尝试使用 jolt 转换进行转换

{
  "School": {
    "Data": {
      "Id": "",
      "Time": "",
      "Txs": "",
      "Pty": {
        "Name": "",
        "ONum": {
          "OID": {
            "REM": {
              "sid": ""
            }
          }
        }
      }
    },
    "Rollingstone": [
      {
        "rollid": {
          "fid": {
            "famt": "",
            "ofaid": ""
          },
          "status": "Login",
          "statusDescription": "Login Successfully",
          "ADDinfo": ""
        }
      }
    ]
  }
}

You can use following successive specs您可以使用以下连续规格

[
  {
    "operation": "shift",
    "spec": {
      "*": {
        "Data": {
          "*": "&2.&1.&",
          "Pty": {
            "*": "&3.&2.&1.&",
            "Number": {
              "*": {
                "*": {
                  "*": "&6.&5.&4.&3.&2.&1.sid"
                }
              }
            }
          }
        },
        "Facebook": {
          "*": {
            "fid": {
              "fedit": "Rollingstone[0].rollid.&1.famt",
              "fcopy": "Rollingstone[0].rollid.&1.ofaid"
            }
          }
        }
      }
    }
  },
  {
    "operation": "modify-overwrite-beta",
    "spec": {
      "Rollingstone": {
        "*": {
          "rollid": {
            "status": "Login",
            "statusDescription": "Login Successfully",
            "ADDinfo": ""
          }
        }
      }
    }
  }
]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM