How to update user metadata

I am practicing/testing on the management api. I am connecting and are getting a userInfo object just fine but am having trouble updating some user meta data.
This is the code I am using.
UserMetaData metaData = new UserMetaData();
metaData.NeedsToAcceptTerms = false;

        var response = await apiClient.Users.UpdateAsync(userId, new Auth0.ManagementApi.Models.UserUpdateRequest
        {
            UserMetadata = JsonConvert.SerializeObject(metaData)
        });

And I get this error thrown.
Message : Payload validation error: ‘Expected type object,null but found type string’ on property user_metadata (User metadata to which this user has read/write access).

Can anyone direct me to what I am doing wrong?

I solved this - I didn’t need to convert the object to a JSON string it should just
UserMetadata = metaData

1 Like

Glad that you figured it out and thanks for sharing with the rest of community!