Skip to main content

I'm really struggling with the string functions in FME at the moment. I have a workbench reading JSON features from an API and I have one attribute where the results are in a list. The JSON extractor results the attributes like this:

 

>"Medium"]

 

Or if there are multiple values, like so:

p"Easy","Advanced"]

 

I want the results to be:

Medium

Intermediate,Easy

 

I want to remove the brackets and quotes using a single transformer and can't figure out the formatting for my life! Currently I have 3 separate "string replacers", each one removing a single character, but there must be a better way...I don't mind using a REGEX expression if someone can figure it out. I'm also open to using a different type of JSON query to extract these values? If there's a way to get the attributes without the brackets and quotes?

 

I also tried using the string pair replacer but I constantly get an error, and I can't seem to format it properly. I wish you could enter the pairs in table format instead of one long string for replacements...would make it so much easier to figure out!

 

Any advice would be appreciated 🙂

Edit: The original question asked how to process r"Intermediate"],d"Easy"]

\>"|"\]

in a StringReplacer in regex mode does the trick. The brackets need to be escaped.

Regex_brackets_quotes 


Edit: The original question asked how to process r"Intermediate"],d"Easy"]

\>"|"\]

in a StringReplacer in regex mode does the trick. The brackets need to be escaped.

Regex_brackets_quotes 

Thanks for your response! Apologies, I did mess up a bit in my question though...the input is  "Easy","Advanced"] I've just updated in the question...

 

Your expression works but doesn't remove the inner quotes. I'm no regex expert so I still have no idea how to fix this unfortunately. If you know how to remove the inner quotes as well that would be great!


For  "Easy","Advanced"] use

\>|"|\]

Regex_brackets_quotes_2 


For  "Easy","Advanced"] use

\>|"|\]

Regex_brackets_quotes_2 

Yes this worked, thank you!


Reply