title: Parse/read decoded jwt token data in typescript
body: <p>How to  parse the below object which is an decoded jwt token using this.jwtHelper.decodeToken(sessionStorage.getItem('encodedToken')) and need to get the privileges of an application(QWE) from roles.</p>
  
  <pre><code>name:"ram8"
  roles:"{"userid":"991635","privileges":{"QWE":["QQT","RR","RRR","FCC","WWW","WRD","DML","UDE","SDE"]}}"
  sub:"123456"
  user.tenant.name:"DefaultDomain"
  __proto__:Object
  </code></pre>
  
  <p>Right now, using the below code to get the roles</p>
  
  <pre><code>public getUserRoles(){
      let userInfoJSON = JSON.parse(JSON.stringify(this.jwtHelper.decodeToken(sessionStorage.getItem('encodedToken'))));
      for (let prop in userInfoJSON) {
          if(prop === 'roles'){
              let roles = JSON.parse(userInfoJSON[prop]);
              for(let rProp in roles){
                  if(rProp === 'privileges'){
                      let privileges = JSON.parse(JSON.stringify(roles[rProp]));
                      for(let prev in privileges){
                          console.log("prev "+prev+" "+privileges[prev])
                          this.userRoles = privileges[prev];
                      }
                  }   
              }
              break;
          }
      }
      console.log("AuthServiceuserRoles "+this.userRoles);
  }
  </code></pre>