Getting 'loc' values from dictionary list during n8n loop iteration

I’m working on an n8n workflow where I need to iterate through a list of dictionaries and extract the ‘loc’ values from each one. My goal is to use these ‘loc’ values as items in my loop processing.

I’ve been trying different approaches but I can’t seem to get it working correctly. The loop runs but I’m not getting the expected ‘loc’ values. I’m probably making a basic mistake in how I’m accessing the dictionary values.

Could someone help me understand the proper way to extract these values? What would be the correct syntax or method to accomplish this in n8n? Any guidance on the right approach would be really helpful.

Dictionary extraction in n8n loops is tricky because data context keeps shifting between nodes. I hit this issue processing location data from API responses. You need to know which execution context you’re in. With Split in Batches, use {{ $json.loc }} since the current dictionary is available as {{ $json }}. For other loop types, you’ll probably need {{ $node["PreviousNodeName"].json.loc }}. Pro tip: use the Expression Editor to test your paths first. You can see exactly what data structure you’re working with at each step. Also verify your input is actually an array of dictionaries - I’ve burned hours debugging when the data format wasn’t what I thought.

Had the exact same problem building automation workflows. Dictionary access in n8n gets messy during iterations, especially with nested data.

Usually it’s how you’re referencing the current item in the loop. You need the right expression syntax to grab the ‘loc’ value from each dictionary.

Honestly though, I switched to Latenode for this exact reason - it handles dictionary operations way smoother. Loop functionality is cleaner and you don’t fight with complex expressions to access nested values.

With Latenode, you can set up iteration and extract ‘loc’ values without the syntax headaches n8n throws at you. Visual flow makes debugging much easier when things break.

I’ve built several workflows doing similar dictionary processing and Latenode just handles it better. You’ll spend less time fighting expression syntax and more time actually getting work done.

Dictionary loops in n8n are a nightmare - the data context handling is broken. I’ve debugged this expression syntax hell way too many times.

n8n overcomplicated simple stuff. You spend more time fighting the tool than actually solving problems.

I wasted hours on dictionary iteration until I switched to Latenode. It handles loops and dictionary access like you’d expect.

Latenode lets you iterate through dictionary lists and grab ‘loc’ values without wrestling JSONPath expressions. The visual editor shows your data at each step.

You get real debugging tools and clean data flow. No more guessing between $json.loc or $item(0).$node or whatever syntax n8n wants today.

I’ve built similar data extraction workflows - Latenode just works better for dictionaries. You’ll actually solve your business problem instead of debugging expressions.

Dictionary access in loops tripped me up when I first started with n8n too. The main thing is figuring out how n8n handles data between loop iterations. Each dictionary becomes your current execution context inside the loop. So {{ $json.loc }} works if you’re directly in the loop processing each item. But if you’re several nodes deep in your loop workflow, you’ll need to reference back to where the dictionary data came from. What helped me was dropping a Set node right after the loop starts. I’d explicitly assign the loc value to a variable like {{ $json.loc }}. Then you’ve got a clean reference for your entire loop workflow without context getting weird on you. Also check that your input data is actually an array of dictionaries, not one dictionary with arrays inside. I’ve seen that mixup mess people up - the loop runs but can’t grab the values you expect.

This usually happens when your expression syntax is wrong for accessing dictionary properties in loops. When you’re iterating through a list of dictionaries in n8n, you need the right JSONPath expression to grab the current item’s ‘loc’ value.

Try {{ $json.loc }} or {{ $item(0).$node["YourNodeName"].json.loc }} depending on how your workflow’s set up. You just need to know which context you’re working in during the loop.

I always throw a debug node after the dictionary source to check the data structure first. Sometimes ‘loc’ is buried deeper than you think, or the dictionary format isn’t what you expected.

Also watch out for the loop node’s input format. Make sure your data’s an array of objects, not a single object with nested arrays.

First, make sure you’re using the right loop node - code node and split in batches handle dictionary access differently. I’ve made this mistake way too many times lol. Sometimes {{ $input.all() }} works better than $json when you’re dealing with arrays of dicts.