title: Format ldap result into json
body: <p>I need to convert ldap result into json. i have been trying for hours and I did not find any solution.</p>
  
  <pre class="lang-py prettyprint-override"><code>search_filter = "CN=My Name"
  attrs = ['givenName', 'sn', 'thumbnail_pic', 'phone', 'mail']
  result = connect.search_s(base_dn, ldap.SCOPE_SUBTREE, search_filter, attrs)
  </code></pre>
  
  <p>I have this output:</p>
  
  <pre class="lang-py prettyprint-override"><code>('CN=My Name,OU=City,OU=Company,DC=com,DC=lan', {'sn': [b'Name'], 'givenName': [b'My'], 'phone': [b'+111 111 111 111'], 'mail': [b'My.Name@company.com'], 'thumbnail_pic': [b'binary data of picture']})
  </code></pre>
  
  <p>And I want to convert it into this pretty json</p>
  
  <pre><code>[
              {
                  "first_name": "My",
                  "last_name": "Name",
                  "picture": "binary data of picture",
                  "phone_number": "+111 111 111 111",
                  "email": "My.Name@company.com",
              }
  ]
  </code></pre>
  
  <p>I am desperate for help since I think I tried almost everything... Any ideas please?</p>