I have pulled in a JSON using the tRest
stage, and some of my values appear like this: ["345"]
. I need to convert this to a integer: 345
. I know I need to remove the extra characters, but I'm having the worst luck using EReplace
and Integer
in a tmap
. I was recommended to use tReplace
. Can someone please show me how to set it so I can remove the brackets and quotes?
Just for the record, here is the line that I tried in tMap
:
Integer.parseInt(StringHandling.EREPLACE(StringHandling.EREPLACE(StringHandling.EREPLACE(row2.rank,"[",""),"]",""),"\"",""))
Thanks.
Instead of using treplace
component, use the code like below in tMap
component
Integer.parseInt(row2.rank.replaceAll("\"","").replaceAll("\\[","").replaceAll("\\]",""));
The above will give you the expected result
Hope this would help you out.