# Setting an array in user\_metadata

**URL:** <https://community.auth0.com/t/setting-an-array-in-user-metadata/98518>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [January 19, 2023, 7:31pm UTC](https://community.auth0.com/t/setting-an-array-in-user-metadata/98518 "2023-01-19T19:31:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mithgroth](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mithgroth/32/33674_2.png) [@mithgroth](https://community.auth0.com/u/mithgroth)\
**Post date:** [January 19, 2023, 7:31pm UTC](https://community.auth0.com/t/setting-an-array-in-user-metadata/98518/1 "2023-01-19T19:31:18Z")

</div>

I’m trying to set an array in user\_metadata, but getting a payload validation error:

> “Expected type object, null but found type array on property user\_metadata”

However I can set an array to user\_metadata directly from portal, and it saves successfully.  
So, why can’t I do this from Management API, or is there a way to do it?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 19, 2023, 9:18pm UTC](https://community.auth0.com/t/setting-an-array-in-user-metadata/98518/3 "2023-01-19T21:18:56Z")

</div>

Hi @mithgroth,

Thanks for reaching out to the Auth0 Community!

> [@mithgroth](#):
>
> I’m trying to set an array in user\_metadata, but getting a payload validation error:

Unfortunately, this is not possible. The user metadata is an Object Type, meaning that you will need to set the array as a property.

For example:

```auto
{
  "user_metadata": { 
    "fav_color" : ["blue", "red"]
  }
}

```

I recommend reading our [Manage Metadata Using the Management API](https://auth0.com/docs/manage-users/user-accounts/metadata/manage-metadata-api) documentation for a walkthrough on updating user\_metadata.

Please let me know if there’s anything else I can do to help.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 2, 2023, 9:19pm UTC](https://community.auth0.com/t/setting-an-array-in-user-metadata/98518/4 "2023-02-02T21:19:21Z")

</div>

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