PBIP-tools is a Python package designed to process Power BI-generated JSON files for enhanced human-readability and seamless version control integration. The package provides two key executables:
-
json-clean
: Converts nested and complex Power BI-generated JSON files into a human-readable format. -
json-smudge
: Reverses the cleaning process, restoring the JSON files to a format that Power BI can properly load.
-
Human-readable JSON: The
json-clean
utility de-nests JSON objects and JSON strings for easier understanding and editing. -
Restoration for Power BI: The
json-smudge
utility ensures that files cleaned byjson-clean
can be reloaded into Power BI. -
Command-line utilities: Both
json-clean
andjson-smudge
can be used directly from the command line for seamless file processing.
You can install the package using pip:
pip install pbip-tools
To clean a Power BI-generated JSON file for readability, run the following command:
json-clean <file-or-glob> [<file-or-glob2> ... ]
Example:
json-clean report.json my_folder/*.json
To restore a cleaned JSON file to its original state for Power BI loading, run:
json-smudge <file-or-glob> [<file-or-glob2> ...]
Example:
json-smudge cleaned_report.json cleaned/**/*.json
This package depends solely on Python’s standard libraries. For contributing and
testing, pre-commit
and pytest
may be required.
This project is licensed under the MIT License. See the LICENSE file for details.
If you would like to contribute, feel free to open issues or submit pull requests.