Support Questions

Find answers, ask questions, and share your expertise

Nifi UpdateAttribute not able to replace \u2028 (
) , \u2029 characters in JSON files

New Contributor

Hi I'm having problems with trying to replace \u2028 and \u2029 in JSON response using UpdateAttribute processor.

Without replacing this my next processor, ReplaceText , truncates the JSON causing it to become invalid.

Can someone help?

3 REPLIES 3

Super Guru

@Abhishek

Is it possible that, you can add sample input data and expected output?

New Contributor

@Shu Trying to do something like the attached, which doesn't work. Also tried the text form

${data:replace("\u2028", "")}

83488-u2028.png

Super Guru

@Abhishek

It would be lot more easier to have script that can go through the json message (or) attribute values and look for \u2028 character and replace with "".

Sample groovy script to replace the "\u2028"

def st = '
    ';
println st.replace("\u2028", "hi") 
Output:
hi

Like this way you can have the Groovy/python ..etc script and use ExecuteGroovyScript/ExecuteScript/InvokeScriptedProcessors to execute the script.

For more reference regarding scripting in nifi refer to this link.

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.