User name from json body

Hi all,

I set up an oauth login/signup for my user and works perfectly fine now :slight_smile:

Now I want to make it more convient for the user to read his username.

The response from the json is as follows:

{
“username”: “user#1234”,
“id”: 123123123
}

I want to show the user name in the top nav bar.

So I did the following:

Add text -> dynamic content -> current user’s username

What is happening now is:

the user name is shown as: “username”: “user#1234”

So it shows the full json response as text but I would like to only show user#1234

Any idea how I can solve this?

Thanks

You could truncate the value. Have a hidden input that calculates the username string’s number of characters minus 10 (the number of characters for "username: " - that includes the space).

Then your dynamic content would be current user’s username truncated from end to this hidden input’s value.

For example, if current user’s username = “username: bob”

The hidden input would calculate the number 3 (13-3)

Dynamic value = “username: bob” truncated from the end to 3 characters in… which results in “bob”

This is one way of achieving. Is there any reason you can’t make an API call to retrieve the authorized user’s user data so that every field is extracted separately and you don’t need to work with the full body result? What API is this for?


Gaby | Coaching Bubble
Private coaching, courses, and tons of free resources