- 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 to replace empty curl braces in nifi
- Labels:
-
Apache NiFi
Created on ‎04-18-2022 12:16 AM - edited ‎04-18-2022 12:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All,
I have a requirement where there are some empty curl braces in my JSON output which needs to be removed and replaced with empty string. The regex seems to work fine to find the braces when tested outside.
Sample can be found here:
https://regex101.com/r/AtTPv1/2
I tried to use this regex in nifi using replaceText, but it's not doing the replace. Below is my config for replaceText.
Can anyone suggest if there are any options to change to make it work or any other better alternatives for working with JSON?
Thanks in advance!
Created ‎04-21-2022 12:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your expression works for me on NiFi 1.15.2. It's too complicated, though, and it still leaves a pair of curly brackets behind.
Try using this one instead:
\{[ \n]*\}[ \n]*,?[ \n]*
Cheers,
André
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Created ‎04-21-2022 12:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your expression works for me on NiFi 1.15.2. It's too complicated, though, and it still leaves a pair of curly brackets behind.
Try using this one instead:
\{[ \n]*\}[ \n]*,?[ \n]*
Cheers,
André
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.
