04-01-2026 04:45 PM
Hi,
I am trying to build a workflow that takes YAML configuration, parses it to JSON, and then does actions with that JSON configuration. Specifically, group policies written in YAML, parsed to JSON, and then created or updated using the relevant Meraki API Atomic.
But for some reason, Workflows seems to be stripping all the newlines from my YAML file when I paste it into the input window when I run the workflow, and this causes my Python script which calls the available YAML libraries in Workflows, to fail.
Does anyone have any advice?
Uploaded an example of the YAML text. The forum wouldn't let me upload a .yaml file.
Solved! Go to Solution.
04-01-2026 05:49 PM
@brdly Do you have your String Type set to YAML for your input?
I just did a quick test and I had no issues. Please see the attached workflow, just change the file extension from .txt to .json and import it.
04-01-2026 05:49 PM
@brdly Do you have your String Type set to YAML for your input?
I just did a quick test and I had no issues. Please see the attached workflow, just change the file extension from .txt to .json and import it.
04-01-2026 09:16 PM
Hey Ed,
Thank you for prompting me to double check that, and for your example Workflow.
I am not exactly sure what happened, because I am certain I was using the Data Type = String, String Type = YAML. But I just tried it again and it appears it is working now? Or it might have been String Type Text before.
It might have also been my Python script as well - I actually read the manual and saw you need to sys.argv to pass stuff to the python script.
Anyway, I can confirm your suggestion definitely works.
Thank you for your time.
04-02-2026 04:54 AM
@brdly Yes, this could have been from the way you were passing the YAML string into your Python script. There are two ways to do this. One is to use Script arguments, that you declare above your script code block and then reference as sys.argv[#]. The advantage of this is you don't have to worry about quoting, and you can easily cut and paste your Python code from your IDE. The second method is to use the Variable Reference icon from the upper right corner of the script block. This will allow you to map a variable value into your code where your cursor is. The disadvantage of this approach is that you do need to properly quote your string, and if you copy and paste new Python code in to the script block, you then have to re-map all of your variables. I'm glad that your YAML is now being parsed correctly. Here's a graphic that shows the two different ways to pass data into a Python script.
04-06-2026 06:02 PM
Hey
That diagram is epic! That definitely needs to into the Meraki Workflows documentation, because it helped me understand how that works instantly.
Thank you for sharing it
04-07-2026 04:07 AM
@brdly Thank you for the feedback. I need to update it to use strings instead of integers and to show that if you use the Variable Reference icon to map variables into the script, they do need to be quoted.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide