I want to configure a script that will dynamically populate variables in the @json payload of the GetJWTByKeyName ampscript function, based on the user data. I know the blow script isn't valid, but what I'm trying to do I've depicted below.

Whenever i try this obviously the ampscript doesn't resolve and it passes the "%%=v(variable)=%%" as the value.

SET @JSON = '{
 "first_name": "%%=v(@FirstName)=%%",
 "last_name": "%%=v(@LastName)=%%",
 "email": "%%=v(@Email)=%%",
 "campaign_id": "%%=v(@FirstName)=%%"
SET @JWT = GetJWTByKeyName("JwtKey2", "HS256", @JSON)
SET @HREF = CONCAT("https:///someurl?sign=",@JWT)
<a href="%%=V(@HREF)=%%">GetJWTByKeyName JWT</a>

1 Answer 1


I did figure this out

I created a variable @payload, and then I created the payload string with a Concat() function. then I set @json = @payload.

This worked properly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .