LDIF to JSON Converter
A robust Python tool for converting LDAP Data Interchange Format (LDIF) files to JSON with support for hierarchical nesting and Base64 decoding.
Features
- LDIF Parsing: Convert LDIF files to structured JSON
- Base64 Handling: Optional decoding of Base64-encoded attributes (
-dflag) - Hierarchical Nesting: Organize entries by DN structure (
-noption) - Flexible I/O: Works with files or stdin/stdout
- Custom Formatting: Control JSON indentation (
-ioption)
Installation
pip install ldif2json
Usage
Basic conversion:
ldif2json input.ldif -o output.json
With hierarchical nesting:
ldif2json input.ldif --nest -o output.json
With Base64 decoding:
ldif2json input.ldif --decode -o output.json
Using pipes:
ldapsearch -x -b "dc=example,dc=com" | ldif2json --nest children
Options
usage: ldif2json.py [-h] [-o OUTPUT] [-i INDENT] [-n [ATTRIBUTE]] [-d] [input_file]
Convert LDIF to JSON with optional Base64 decoding and nesting
positional arguments:
input_file Input LDIF file (default: stdin)
options:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output JSON file (default: stdout)
-i INDENT, --indent INDENT
JSON indentation spaces (0 for compact output) (default: 2)
-n [ATTRIBUTE], --nest [ATTRIBUTE]
Enable hierarchical nesting under specified attribute (default: None)
-d, --decode Decode Base64-encoded attributes (marked with ::) (default: False)
License
MIT License
Metadata
Release files for ldif2json 1.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ldif2json-1.0.8.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ldif2json-1.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.4 kB
Release files / ldif2json-1.0.8.tar.gz
| Download URL | ldif2json-1.0.8.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b3606bda3b57f3df972c94bcec7d59077c28448112c487b64f6cf3a5a5950a0
|
|
BLAKE2b-256 checksum How to use checksums |
06b9aa9c020ab6c0f5efda51761c846eb61fefe101ef97b13b3c0a7b156a38a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|
Release files / ldif2json-1.0.8-py3-none-any.whl
| Download URL | ldif2json-1.0.8-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e630bcc23caddee0a0cbbf8abf5b47cb66968550c4a3a769a0186f1cebe35372
|
|
BLAKE2b-256 checksum How to use checksums |
6746d387c815e620125fe8ceec5b49071d9fd93e4c623116bf1fcc74c04a3aec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.10.16
|