Support Questions
Find answers, ask questions, and share your expertise

Help Transfoming Jolt Json

Help Transfoming Jolt Json

New Contributor

Hi,

Can someone please help me in transforming below json, I tried by following the nifi jolt transormation guide available in the community, but I couldn't. Thanks in advance.

[ {
"value_schema_id" : "XXXXXXX",
"system_code" : "XXXXXXXXX",
"event_type" : "XXXXXXXXX",
"metric_name" : "XXXXXXX",
"metric_id" : "1",
"global_person_profile_id" : "2",
"create_ts" : "3"
}, {
"value_schema_id" : "XXXXXXX",
"system_code" : "XXXXXXX",
"event_type" : "XXXXXXXXX",
"metric_name" : "XXXXXXX",
"metric_id" : "1",
"global_person_profile_id" : "2",
"create_ts" : "3"
} ]

As mentioned below:

{

  "value_schema_id": XXXXXX,

  "records": [

    {

      "value": {

        "system_code": "XXXXXX",

        "event_type": "XXXXXX",

        "event_detail": {

          "metric_name": "XXXXXX",

          "metric_id": "XXXXXX",

          "global_person_profile_id": "XXXXXX",

          "create_ts": "XXXXXX"

        }

      }

    }

  ]

}

1 REPLY 1

Re: Help Transfoming Jolt Json

Contributor

Hi @tsvk4u,

Please check the following jolt and tell me if it's okay

[
{
"operation": "shift",
"spec": {
"*": {
"value_schema_id": "&",
"system_code": "records[&1].value.&",
"event_type": "records[&1].value.&",
"metric_name": "records[&1].value.event_detail.&",
"metric_id": "records[&1].value.event_detail.&",
"create_ts": "records[&1].value.event_detail.&",
"global_person_profile_id": "records[&1].value.event_detail.&"
}
}
},
{
"operation": "cardinality",
"spec": {
"value_schema_id": "ONE"
}
}
]