Parse the output of ldapsearch, LDAP Data Interchange Format, into json.
go build .
# Parse from stdin
ldapsearch -H ldap://hostname -LLL -b 'base_ou' 'memberOf=group1' displayName | ./ldapper
# Parse from file
./ldapper ldap_result.ldif
Example input:
dn: cn=The Postmaster,dc=example,dc=com
objectClass: organizationalRole
cn: The Postmaster
Output:
[
{
"cn": ["The Postmaster"],
"dn": ["cn=The Postmaster,dc=example,dc=com"],
"objectClass": ["organizationalRole"]
}
]