title: Angular - TypeError: Converting circular structure to JSON
body: <p>I'm getting this error at angular service's map method but my returned datas doesn't seem to contain any circular reference, here is my json object:</p>
  
  <pre><code>[{"id":14,
    "sender": 
      {"id":20,"email":"p.martelliere@gmail.com","username":"test5","roles": 
      ["ROLE_USER"],"status":"active","note":"0","points":0,
      "devices":[],"job":"Caisse","showJob":false,"notificationsActivated":true,
      "connected":true,"tokenConfirm":"","birthDate":[]
  },"receiver": 
       {"id":12,"email":"test2@yopmail.com","username":"test2","tokenConfirm":"",
       "job":"g\u00e9rant","showJob":false,"note":"0","points":0,
       "roles":["ROLE_USER"],"status":"active","notificationsActivated":true,
       "connected":true,"devices":[]
  },
    "myNeed":"Te ster",
    "whatICanGive":"1",
    "messages":[],
    "status":"active"
  }]
  </code></pre>
  
  <p>Here's my chatRequest angular Entity:</p>
  
  <pre><code>export class NmChatRequest {
      // Raw attributes
      id : number;
      myNeed : string;
      whatICanGive : string;
      status : string;
      createdAt : Date;
      updatedAt : Date;
      deletedAt : Date;
      // x-to-one
      id_receiver: number;
  
  
      constructor(json? : any) {
          if (json != null) {
              this.id = json.id;
              this.myNeed = json.myNeed;
              this.whatICanGive = json.whatICanGive;
              this.status = json.status;
              this.id_receiver = json.id_receiver;
              if (json.createdAt != null) {
                  this.createdAt = new Date(json.createdAt);
              }
              if (json.updatedAt != null) {
                  this.updatedAt = new Date(json.updatedAt);
              }
              if (json.deletedAt != null) {
                  this.deletedAt = new Date(json.deletedAt);
              }
          }
      }
  }
  </code></pre>
  
  <p>This entity is used to get the object from json.</p>
  
  <p>Here's my ChatRequestService:</p>
  
  <pre><code>/**
       * Create the passed nmChatRequest.
       */
      add(nmChatRequest : NmChatRequest, token: string) : Observable&lt;NmChatRequest&gt; {
          let body = nmChatRequest;
  
          return this.http.post(this.chatUrl, body, {headers: new HttpHeaders({ 'Content-Type': 'application/json', 'X-Auth-Token': token })})
              .pipe(
                  map(response =&gt; new NmChatRequest(response)),
                  catchError(this.handleError)
              );
      }
  </code></pre>
  
  <p>What am I missing ?</p>
  
  <p>Thanks to anyone who will take the time to read/answer this question.</p>