# JSDoc Passing Array of Objects Notation

**URL:** <https://forum.servoy.com/t/jsdoc-passing-array-of-objects-notation/17051>\
**Category:** Classic Servoy\
**Created:** [February 25, 2013, 9:41pm UTC](https://forum.servoy.com/t/jsdoc-passing-array-of-objects-notation/17051 "2013-02-25T21:41:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [February 25, 2013, 9:41pm UTC](https://forum.servoy.com/t/jsdoc-passing-array-of-objects-notation/17051/1 "2013-02-25T21:41:28Z")

</div>

Version: 6.1.3 - build 1424

How do you JSDoc annotate a method whose only parameter is an array of Objects?

I use the following JSDoc line:

```auto
@param {Array<Object>} a An array of Objects

```

which seems to satisfy the JSDoc parser, but when referencing Object members, the following warning is emitted:

> The property member\_name is undefined for the Javascript type Object.

Meta-code that emits the error:

```auto
for ( var i = 0; i < a.length; i++ )
{
    var o = a[i]
        
    var x = o.member_name

    <more code>
}

```

I tried various permutations of the Object double-braces notation in the @param line of code, but the JSDoc parser complains:

> {{ member\_1 : String, member\_2 : Number, member\_3 : Boolean }}

By the way, the method’s code works as expected…it’s just the JSDoc warnings that I cannot seem to clear.

EDIT: Never mind…I figured it out. Keep the JSDoc @param as is and add @type with the double-braces detail to the declared Object in the code.

---

<div class="post-metadata">

**Author:** ![mboegem](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/mboegem/32/4399_2.png) [@mboegem](https://forum.servoy.com/u/mboegem)\
**Post date:** [February 25, 2013, 10:37pm UTC](https://forum.servoy.com/t/jsdoc-passing-array-of-objects-notation/17051/2 "2013-02-25T22:37:52Z")

</div>

Hi Kim,

yes, using @type is a solution.

this is what you were looking for:

```auto
@param {Array<{member_name:String, member_id:Number}>} myVarName

```

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [February 26, 2013, 5:49pm UTC](https://forum.servoy.com/t/jsdoc-passing-array-of-objects-notation/17051/3 "2013-02-26T17:49:39Z")

</div>

Thanks for the assist, Marc! I prefer your annotation and changed mine accordingly.
