Cast string back to an array

I need to cast a string back into an array. The LLM function originally used to extract an array of arrays from a list of exercises, then used AIP to generate transforms to flatten the arrays, then explode the flattened array. Though that made it a string value and I don’t know how to stop it from doing that.

The resulting string value in the row is in this format:

[“depth jump”,“De. Ju.”,“Assistance”,“Fundamental”,“Group 13”,“General leg exercises”,“82”]

I’m trying to cast that back into an array in order to do Array Position and extract elements to their own columns. AIP generate can’t figure out how to do it, or I don’t know the magic words to do it.

Can you try and use the parse json expression? That should work here I think

1 Like

Hello,

If the input value have an Array[String] datatype, using explode transform of a 2D Array shouldn’t change the data type to String.

If for some reason, you have the input data as string, you can do below workaround.

  • Use Regex to replace quotes " and Square brackets with Empty string.
  • Use Split string transform to split by comma. ( Please make sure that your input data didn’t contain comma inside an element, otherwise , it will also be splitted )

I hope this helps.