- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
regex on keys jolt
- Labels:
-
Apache NiFi
Created ‎09-12-2022 08:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'd like to catch any key that match a certain reg ex in jolt. The purpose is to clean and order keys into the proper name. An example worth thoushand words:
possible inputs:
{
"my_id":234535,
"my company sa": "whatever value",
"my comp RH": "whatever value",
...
}
{
"my_id":234536,
"my_comp_sa" : "whatever value",
"DRH" : "whatever value"
...
}
output:
{
"my_id":234535,
"my_company_sa": "whatever value",
"my_company_rh" : "whatever value"
}
Created ‎09-12-2022 09:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm not sure if you can use Regex in jolt transformation, but you can use wildcard (*) instead. Keep in mind even with Regex you still need to find the common denominator for each attribute to be able to match, so wildcard should suffice. To use the wildcard you can apply something like this to your spec:
[
{
"operation": "shift",
"spec": {
"my_id": "my_id",
"my*company*sa": "my_company_sa",
"*RH": "my_company_rh"
}
}
]
Hope that helps, if it does please accept solution.
Thanks
Created ‎09-14-2022 07:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Actually, it looks like this kind of regEx does not work. Though my question. I'm using Nifi 11.4...
Thank you for your feedback 🙂
