Niet is a powerful command-line interface (CLI) tool designed for efficient interaction with YAML, JSON, and TOML data files. It allows users to slice, filter, map, transform, and convert structured data using simple expressions or advanced XPath features directly from the shell. Written in Python, `niet` is actively maintained, with its latest version 3.2.0 released in April 2023.
pip install nietNo compatibility data collected yet for this library.
This quickstart demonstrates basic data extraction from YAML and JSON files using `niet`. First, it creates a sample `config.yaml` file and extracts the project name. Then, it creates a `data.json` file and extracts a specific item's value using a filter expression.
Upgrade to Python 3.9+ or use `niet<2.0` (not recommended as it's unsupported).
To integrate `niet` functionality into Python scripts, use `subprocess` calls to execute `niet` commands.
Always back up files before using `--in-place`, or redirect output to a new file and manually replace the original after verification.
Ensure `niet` is installed (`pip install niet`) and that your shell's PATH includes the directory where `pip` installs executables (e.g., `~/.local/bin` on Linux or `Scripts` directory in your Python environment on Windows). You might need to restart your terminal.
Verify the file path and name are correct. Use `ls` or `dir` to confirm the file's presence.
Inspect the input file for syntax errors using a linter or validator for YAML, JSON, or TOML. Ensure it conforms to the expected format.