TS casting json response to class

Hallo there, i’m getting the following server response from my azure server: {"ErrorText":null,"ServerAnswer":"Hello","OperationSuccess":true} the value i expect. Here’s the code snippet:

  public async SayHello(): Promise<AuthResponseModel> {
      const response = await this.http.get<AuthResponseModel>(this.authServiceUrl, {
        params: {
          action: 'hello'
      return response;

for the authService. And to display the value via object:

    this.authService.SayHello().then(response => {
      if (response.OperationSuccess) {
        let x = response.ServerAnswer?.toString();
        window.alert("success: " + x)
      } else {
        window.alert("error: " + response.ErrorText?.toString())

and the response object:

export class AuthResponseModel {
    public ErrorText: string = ""
    public ServerAnswer: string = ""
    public OperationSuccess: boolean = false

But the console shows a var value of undefinded in the huge object. Deos anyone knows the answer for this problem?

Thank you and nice event.
Greets from Germany :slight_smile: