# Array of Objects as return type?

**URL:** <https://connect.superhuman.com/t/array-of-objects-as-return-type/27532>\
**Category:** Making Packs\
**Created:** [December 18, 2021, 4:16am UTC](https://connect.superhuman.com/t/array-of-objects-as-return-type/27532 "2021-12-18T04:16:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![louca.developer](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/louca.developer/32/22685_2.png) [@louca.developer](https://connect.superhuman.com/u/louca.developer)\
**Post date:** [December 18, 2021, 4:16am UTC](https://connect.superhuman.com/t/array-of-objects-as-return-type/27532/1 "2021-12-18T04:16:20Z")

</div>

How can one declare the return type for a Formula that returns an Array of Objects, say like:

```auto
[{'id': 'abc123', 'name': 'alice'}, {'id': 'xyz789', 'name': 'bob'}, ...]

```

I’m guessing you specify in the `addFormula` param object:

```auto
  ...
  resultType: coda.ValueType.Array,
  items: { type: coda.ValueType.Object },
  ...

```

But where can you specify that the items have a schema `mySchema`?

---

<div class="post-metadata">

**Author:** ![louca.developer](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/louca.developer/32/22685_2.png) [@louca.developer](https://connect.superhuman.com/u/louca.developer)\
**Post date:** [December 18, 2021, 4:27am UTC](https://connect.superhuman.com/t/array-of-objects-as-return-type/27532/2 "2021-12-18T04:27:24Z")

</div>

Found it:

`items: mySchema`

(I was doing `items: {type: mySchema}`)

May want to document this better in the usage, had to dig to this reference page to find it: [Type alias: ArrayFormulaDef - Coda Pack SDK](https://coda.github.io/packs-sdk/reference/sdk/types/ArrayFormulaDef/)

---

<div class="post-metadata">

**Author:** ![Eric\_Koleda](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/eric_koleda/32/50286_2.png) [@Eric\_Koleda](https://connect.superhuman.com/u/Eric_Koleda)\
**Post date:** [December 18, 2021, 1:27pm UTC](https://connect.superhuman.com/t/array-of-objects-as-return-type/27532/3 "2021-12-18T13:27:23Z")

</div>

Ya, this tripped me up at first too. I’ll make sure we document this more clearly.

---

<div class="post-metadata">

**Author:** ![system](https://yyz1.discourse-cdn.com/coda1/user_avatar/connect.superhuman.com/system/32/24484_2.png) [@system](https://connect.superhuman.com/u/system)\
**Post date:** [December 21, 2021, 1:27pm UTC](https://connect.superhuman.com/t/array-of-objects-as-return-type/27532/4 "2021-12-21T13:27:25Z")

</div>

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