In this simplified scenario:
export class LoginComponent{
grant_type: string="password";
jsonPayload: string;
Login(username, password){
this.jsonPayload = JSON.stringify({ username: username, password: password, grant_type: this.grant_type });
}
}
When using stringify in TypeScript, ensure to properly structure the JSON object like shown above.
Thank you,