A small package to convert JSON files to NDJSON (Newline Delimited JSON) format.
Project description
JSON to NDJSONify
Table of Contents
Overview
JSON to NDJSONify is a Python package specifically engineered for converting JSON files to NDJSON (Newline Delimited JSON) format. Built for developers who are working with APIs or data platforms that require NDJSON input, this package helps streamline your workflow by automating the conversion process.
Features
- Supports complex nested JSON structures
- Ability to filter specific nodes (e.g.,
edges
) - Highly optimized and lightweight
- Written in Python, making it highly extensible and maintainable
- Unit tests to validate NDJSON output
Installation
Clone the repository:
git clone https://github.com/mohjak/json_to_ndjsonify.git
Navigate to the cloned directory and run:
pip install .
Or directly via pip:
pip install json-to-ndjsonify
Usage
Basic Usage
To convert a JSON file to NDJSON:
json-to-ndjsonify --input sample.json --node edges
This will create an NDJSON file in the same directory as the sample.json
file, suffixed with a timestamp.
Advanced Usage
For additional configurations, consult the inline help:
json-to-ndjsonify --help
Configuration
Command-Line Parameters
-
--input
: Specifies the path of the JSON file to be converted. -
--node
: Specifies the node name in the JSON file. Default is 'edges'. -
--output
: Path to the output folder.Example:
json-to-ndjsonify --input /path/to/your/file.json --node custom_edges --output /path/to/output/folder
Running Tests
To execute the unit tests:
export NDJSON_DIR=/path/to/your/ndjson/directory
python -m unittest tests/test_main.py
Contributing
See the CONTRIBUTING.md file for how to contribute to this project.
License
This package is licensed under the MIT License. See the LICENSE.md
file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for json_to_ndjsonify-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8cbbba2aeb79fe3c411a00fc63756ed5d780dd8055ed197af267c5eb0f9093f |
|
MD5 | a5f8a952333b94886043905e899d7e60 |
|
BLAKE2b-256 | 817aebb61d30019789628cc0c8f1df8ab3a2e0cf602638263be95ec7cfc4e6af |