What's the purpose of the json key in the data structures?

n8n is amazing, but sitting down and trying to knock out a block in Code just seems unnecessarily painful. Can someone help me understand why all the data needs to be unlocked with a ‘json’ key, when that same data is displayed without any json keys in the input and output, and is only sometimes required when you’re returning data? All we’re doing is passing arrays of objects between nodes.

Perhaps I am simply thinking about this in the wrong way, but something like:

$items(‘Node Name’).forEach(value => {
console.log(value[‘name’])
}

Seems identical except less confusing than having to do console.log(value[‘json’][‘name’]. What value does this extra complexity bring, that I’m apparently missing?

/end rant :slight_smile:

Hi there,

Welcome to the community.

this is because an item doesnt only hold data (in the form of the JSON) but can also hold Binary data.
this doc will show you some more info:

another nice resource:

1 Like

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