{"id":8352,"library":"niet","title":"Niet: YAML, JSON, TOML CLI Tool","description":"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.","status":"active","version":"3.2.0","language":"en","source_language":"en","source_url":"https://github.com/openuado/niet","tags":["cli","yaml","json","toml","configuration","data manipulation"],"install":[{"cmd":"pip install niet","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required runtime environment.","package":"python","version":">=3.9"}],"imports":[],"quickstart":{"code":"echo \"---\\nproject:\\n  meta:\\n    name: my-app\\n  version: 1.0.0\" > config.yaml\nniet config.yaml \"project.meta.name\"\n# Expected output: my-app\n\necho '{\"data\": {\"items\": [{\"id\": 1, \"value\": \"alpha\"}, {\"id\": 2, \"value\": \"beta\"}]}}' > data.json\nniet data.json \"data.items[?id=2].value\"\n# Expected output: beta","lang":"bash","description":"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."},"warnings":[{"fix":"Upgrade to Python 3.9+ or use `niet<2.0` (not recommended as it's unsupported).","message":"Python 2.7 support was dropped in `niet` version 2.0. If you require Python 2.7, you must use a version of `niet` lower than 2.0.","severity":"breaking","affected_versions":"< 2.0"},{"fix":"To integrate `niet` functionality into Python scripts, use `subprocess` calls to execute `niet` commands.","message":"`niet` is primarily a command-line interface tool and is not designed for direct programmatic import and use within Python scripts like a typical library. All core functionalities are exposed via its CLI.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always back up files before using `--in-place`, or redirect output to a new file and manually replace the original after verification.","message":"Using the `-i` or `--in-place` argument will modify the input file directly, replacing its content with the `niet` command's output. This can lead to unintended data loss if not used carefully or without backups.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"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.","cause":"The `niet` executable is not in your system's PATH, or the package was not installed correctly.","error":"niet: command not found"},{"fix":"Verify the file path and name are correct. Use `ls` or `dir` to confirm the file's presence.","cause":"The input file specified for `niet` does not exist at the given path.","error":"ERROR: [Errno 2] No such file or directory: 'non_existent_file.yaml'"},{"fix":"Inspect the input file for syntax errors using a linter or validator for YAML, JSON, or TOML. Ensure it conforms to the expected format.","cause":"The input file (YAML, JSON, or TOML) contains syntax errors and cannot be parsed by `niet`. `niet` exits with a non-zero status code (e.g., 1) in such cases.","error":"ERROR: Unable to parse file, check the format: \"Invalid YAML syntax\""}]}