# Best way to convert a UserGetSingleton to User SDK 21

**URL:** <https://devforum.okta.com/t/best-way-to-convert-a-usergetsingleton-to-user-sdk-21/32752>\
**Category:** Questions\
**Tags:** java\
**Created:** [March 27, 2025, 7:21pm UTC](https://devforum.okta.com/t/best-way-to-convert-a-usergetsingleton-to-user-sdk-21/32752 "2025-03-27T19:21:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelpMeLearnOkta](https://avatars.discourse-cdn.com/v4/letter/h/bb73d2/32.png) [@HelpMeLearnOkta](https://devforum.okta.com/u/HelpMeLearnOkta)\
**Post date:** [March 27, 2025, 7:21pm UTC](https://devforum.okta.com/t/best-way-to-convert-a-usergetsingleton-to-user-sdk-21/32752/1 "2025-03-27T19:21:54Z")

</div>

I’m confused by the getUser call

> **[UserApi (Okta Java SDK 20.0.0 API)](https://okta.github.io/okta-sdk-java/20.0.0/apidocs/com/okta/sdk/resource/api/UserApi.html#getUser(java.lang.String,java.lang.String,java.lang.String))**
>
> declaration: package: com.okta.sdk.resource.api, class: UserApi

It is now returning a new UserGetSingleton object.  
Most of the methods seem to still use the User object. Seems like a miss match now.  
I can get a user but can’t pass it in anywhere.

I was ready to write some function that would convert/copy over the UserSinglton back to the User, but I can’t set the userId. I can only get it.

Any idea what to do here?

1. How do a get a user (either by id or username) that I can use in other calls?
2. Any way to convert the user?

---

<div class="post-metadata">

**Author:** ![erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@erik](https://devforum.okta.com/u/erik)\
**Post date:** [March 27, 2025, 7:56pm UTC](https://devforum.okta.com/t/best-way-to-convert-a-usergetsingleton-to-user-sdk-21/32752/2 "2025-03-27T19:56:01Z")

</div>

Hello,

Can you try,

```auto
UserGetSingleton userGetSingleton = userApi.getUser(email, null, "true");

// convert UserGetSingleton object type to User object type
User convertedUser = userApi.getApiClient().getObjectMapper().convertValue(userGetSingleton, User.class);

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [April 26, 2025, 7:56pm UTC](https://devforum.okta.com/t/best-way-to-convert-a-usergetsingleton-to-user-sdk-21/32752/3 "2025-04-26T19:56:15Z")

</div>

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