Extract var content within xml

Hello, I am having trouble extracting the content within the var stateJSON in the xml file that I have. I have tried to convert it to JSON, but I get an error about the node not being able to recognize “var”. I’ve converted it to string first, but that didn’t really help either. Here’s the workflow I have right now.

xml var.knwf (205.8 KB)

My goal is to be able to extract the names of all the states.

One thing to note, I have very little experience with Javascript, so if the answer involves using it in some way, please be patient with me.

Thank you!

Hi daniel_yi,

you can use a regex to isolate the JSON string with the Regex Extractor, then parse it to a JSON cell and from there further split it.

I have extended the workflow for you and put it to my NodePit space. Have fun!

[edit] Forgot the link, sorry! Here it is:

– Philipp



Thank you!!! My solution was to use string manipulation to get rid of everything surrounding it, but your answer is exactly what I was looking for.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.