title: different type of python dict
body: <p>I'm new to python, I have created a script where expected outputs should be able to get user that has <em>globalRole = Admin</em> and user with <em>tprojectRole = Admin</em>. I am getting the values in the json file which it is a dictionary. How can I get my expected values below after my example no. 3?
  Thanks</p>
  <p>Below are examples of JSON file that I'm parsing.</p>
  <pre><code>&quot;firstName&quot;: &quot;User&quot;,
  &quot;lastName&quot;: &quot;Last&quot;,
  &quot;emailAddress&quot;: &quot;user.last@g.com&quot;,
  &quot;locale&quot;: &quot;en_GB&quot;,
  &quot;isActive&quot;: &quot;1&quot;,
  &quot;defaultTestprojectID&quot;: &quot;&quot;,
  &quot;globalRole&quot;: {
      &quot;name&quot;: &quot;admin&quot;,
      &quot;rights&quot;: [
          {
              &quot;name&quot;: &quot;testplan_execute&quot;,
              &quot;dbID&quot;: &quot;1&quot;
          },
          {
              &quot;name&quot;: &quot;testplan_create_build&quot;,
              &quot;dbID&quot;: &quot;2&quot;
          },
      ],
      &quot;dbID&quot;: &quot;10&quot;
  },
  &quot;globalRoleID&quot;: &quot;10&quot;,
  &quot;tprojectRoles&quot;: &quot;&quot;,
  </code></pre>
  <p>This is the other example of JSON file where <em>tprojectRoles</em> has value but <em>globalRole</em> is not an admin.</p>
  <pre><code>&quot;firstName&quot;: &quot;User2&quot;,
      &quot;lastName&quot;: &quot;Last2&quot;,
      &quot;emailAddress&quot;: &quot;user2.last2@g.com&quot;,
      &quot;locale&quot;: &quot;en_GB&quot;,
      &quot;isActive&quot;: &quot;1&quot;,
      &quot;defaultTestprojectID&quot;: &quot;&quot;,
      &quot;globalRole&quot;: {
          &quot;name&quot;: &quot;viewer&quot;,
          &quot;rights&quot;: [
              {
                  &quot;name&quot;: &quot;testplan_execute&quot;,
                  &quot;dbID&quot;: &quot;1&quot;
              },
              {
                  &quot;name&quot;: &quot;testplan_create_build&quot;,
                  &quot;dbID&quot;: &quot;2&quot;
              },
          ],
          &quot;dbID&quot;: &quot;10&quot;
      },
      &quot;globalRoleID&quot;: &quot;10&quot;,
      &quot;tprojectRoles&quot;: {
      &quot;1456505&quot;: {
          &quot;name&quot;: &quot;admin&quot;,
      }
  </code></pre>
  <p>Example no. 3, if both global role and projectrole is Admin it should display both.</p>
  <pre><code>&quot;firstName&quot;: &quot;User3&quot;,
      &quot;lastName&quot;: &quot;Last3&quot;,
      &quot;emailAddress&quot;: &quot;user3.last3@g.com&quot;,
      &quot;locale&quot;: &quot;en_GB&quot;,
      &quot;isActive&quot;: &quot;1&quot;,
      &quot;defaultTestprojectID&quot;: &quot;&quot;,
      &quot;globalRole&quot;: {
          &quot;name&quot;: &quot;admin&quot;,
          &quot;rights&quot;: [
              {
                  &quot;name&quot;: &quot;testplan_execute&quot;,
                  &quot;dbID&quot;: &quot;1&quot;
              },
              {
                  &quot;name&quot;: &quot;testplan_create_build&quot;,
                  &quot;dbID&quot;: &quot;2&quot;
              },
          ],
          &quot;dbID&quot;: &quot;10&quot;
      },
      &quot;globalRoleID&quot;: &quot;10&quot;,
      &quot;tprojectRoles&quot;: {
      &quot;1456505&quot;: {
          &quot;name&quot;: &quot;admin&quot;,
      }
  </code></pre>
  <p>Now, How to get this expected values?</p>
  <pre><code>    User Last GlobalRole: Admin
      User2 Last2 GlobalRole: Viewer ProjectRole: Admin
      User3 Last3 GlobalRole: Admin ProjectRole: Admin
  </code></pre>
  <p>This is my script the I'm working on:</p>
  <pre><code>for admin in tls.getUserByID(loginID): #getUserByID API
              firstName = admin.get('firstName')
              lastName = admin.get('lastName')
              globalRole = admin.get('globalRole')
              projectRole = admin.get('tprojectRoles')
              user_active = ('Active')
              user_inactive = ('Inactive')
      if str(globalRole['name']) == &quot;admin&quot; or str(projectRole) == &quot;&quot;:
          print(loginID, loginName, firstName, str(globalRole['name']))                   
      else:
          for projKey,projRole in projectRole.items():
              if &quot;admin&quot; in str(projRole['name']):
                  print(loginID, loginName, firstName, str(globalRole['name']), projKey, projRole['name'])
  </code></pre>