# Returning a array from Code Node - A 'json' property isn't an object

**URL:** <https://community.n8n.io/t/returning-a-array-from-code-node-a-json-property-isnt-an-object/29550>\
**Category:** Questions\
**Tags:** code\
**Created:** [August 20, 2023, 12:44am UTC](https://community.n8n.io/t/returning-a-array-from-code-node-a-json-property-isnt-an-object/29550 "2023-08-20T00:44:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![atomtr](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@atomtr](https://community.n8n.io/u/atomtr)\
**Post date:** [August 20, 2023, 12:44am UTC](https://community.n8n.io/t/returning-a-array-from-code-node-a-json-property-isnt-an-object/29550/1 "2023-08-20T00:44:22Z")

</div>

## Describe the problem/error/question

A code node with just this line -  
`return ['1','2','3','4'];`  
gives me a error “A ‘json’ property isn’t an object”

## What is the error message (if any)?

“A ‘json’ property isn’t an object”

Returning an array is useful to use a batch node following the code node, or let the default n8n behavior where it runs the next node once for each item automatically (e.g save them to a database).

This used to be working in the 0.9.\* versions before I recently upgraded to 1.1 version.

I hope it is still possible to return an array from a code node, and I am missing something small/obvious here.

Any help is appreciated, Thanks !

## Information on your n8n setup

- n8n version: 1.1.1
- Running n8n via Docker compose

---

<div class="post-metadata">

**Author:** ![Jon](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jon/32/40174_2.png) [@Jon](https://community.n8n.io/u/Jon)\
**Post date:** [August 21, 2023, 10:24am UTC](https://community.n8n.io/t/returning-a-array-from-code-node-a-json-property-isnt-an-object/29550/3 "2023-08-21T10:24:44Z")

</div>

Hey @atomtr,

To be honest I would expect that to fail even in 0.2.x as we expect the data to be JSON, If you were to do something like…

```auto
return [{id:'1'},{id:'2'},{id:'3'},{id:'4'}];

```

That would return an array and give you 4 items so the next node would run 4 times.

 ![image](https://europe1.discourse-cdn.com/n8n/original/3X/4/e/4edce1b8fbdbc0bb594b767cc3f9e7c7060d0c3e.jpeg)

---

<div class="post-metadata">

**Author:** ![atomtr](https://avatars.discourse-cdn.com/v4/letter/a/7ab992/32.png) [@atomtr](https://community.n8n.io/u/atomtr)\
**Post date:** [September 9, 2023, 7:51pm UTC](https://community.n8n.io/t/returning-a-array-from-code-node-a-json-property-isnt-an-object/29550/4 "2023-09-09T19:51:49Z")

</div>

Thanks for that @Jon - I guess I must have been on an even older version and now have updated my workflow to return proper json objects. Cheers

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [December 8, 2023, 7:52pm UTC](https://community.n8n.io/t/returning-a-array-from-code-node-a-json-property-isnt-an-object/29550/5 "2023-12-08T19:52:45Z")

</div>

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