A tool to convert JSONL to HTML
Project description
JSONL to HTML Converter
A simple command-line tool to convert JSONL (JSON Lines) and JSON files into HTML format. This tool is designed to facilitate the visualization of structured data stored in JSONL or JSON format.
Usage
Command Line
# Convert JSONL file
jsonl2html some_file.jsonl
# Convert JSON file
jsonl2html some_file.json
# Get help
jsonl2html --help
# Specify custom index column
jsonl2html some_file.jsonl --index_column=some_column
# Specify custom output file
jsonl2html some_file.jsonl --fn_output=custom_output.html
Python API
from jsonl2html import convert_jsonl_to_html
# Convert JSONL file
convert_jsonl_to_html(
fn_input="examples/small.jsonl",
index_column='auto',
fn_output="auto",
additional_table_content={"content": "value"}
)
# Convert JSON file
convert_jsonl_to_html(
fn_input="examples/test.json",
index_column='auto',
fn_output="auto"
)
Features
- Multiple Input Formats: Convert JSONL and JSON files to HTML format
- Automatic Index Detection: Smart detection of index columns (question, prompt, title, etc.)
- Configurable Settings: Customize behavior via configuration file
- File Size Warnings: Automatic warnings for large files
- Interactive HTML Output: Generated HTML includes navigation, search, and expandable content
- Unicode Statistics: Optional unicode analysis and statistics (requires
unicode_statspackage)
Configuration
The tool supports configuration via jsonl2html/config.json. Default settings:
{
"auto_index_columns": ["question", "questions", "prompt", "prompts", "title", "name"],
"max_lines": 10000,
"file_size_warning_mb": 50,
"logging_level": "INFO"
}
Configuration Options
- auto_index_columns: List of column names to automatically detect for indexing
- max_lines: Maximum number of lines to process from input files
- file_size_warning_mb: File size threshold (MB) for showing warnings
- logging_level: Logging verbosity (DEBUG, INFO, WARNING, ERROR)
Installation
From Source
# Clone the repository
git clone <repository-url>
cd jsonl2html
# Install in development mode
pip install -e .
Build from Sources
# Build distribution packages
python -m build
# Install the built package
pip install dist/jsonl2html-*.whl
Examples
The examples/ directory contains sample files:
examples/test.json: Simple JSON array with questions and answersexamples/single_object.json: Single JSON object exampleexamples/small.jsonl: JSONL file with complex programming problems
Try them out:
jsonl2html examples/test.json
jsonl2html examples/small.jsonl
Output
The tool generates an interactive HTML file with:
- Navigation Panel: Browse through all entries with search functionality
- Content Area: Display selected entries with expandable sections
- Table of Contents: Overview and statistics about the dataset
- Responsive Design: Works on desktop and mobile devices
Error Handling
The tool provides helpful error messages for:
- Invalid file formats
- Missing files
- JSON parsing errors
- Configuration issues
- Large file warnings
Requirements
- Python >= 3.6
- Dependencies:
fire,tabulate - Optional:
unicode_stats(for unicode analysis)
Version History
v0.2.0
- ✅ Added JSON file support
- ✅ Added configuration file support
- ✅ Improved logging system
- ✅ Added file size warnings
- ✅ Better error handling
Known Issues
- Double-click navigation issues in some browsers
- Limited search functionality
- Basic list visualization for arrays
Contributing
Contributions are welcome! Please feel free to submit pull requests or create issues for bugs and feature requests.
License
MIT License - see LICENSE 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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jsonl2html-0.3.0.tar.gz.
File metadata
- Download URL: jsonl2html-0.3.0.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6c402a56ea2e9ed5cd3edd46e36af711eec8c3b467050c2d51ac873363d0e74
|
|
| MD5 |
bc0219abacdd32a7334bcfbe304ebf5a
|
|
| BLAKE2b-256 |
4bc403ca3c35697d78f538f5136d1859e7137e5ed9ef89caf51c1eef032c7c9d
|
File details
Details for the file jsonl2html-0.3.0-py3-none-any.whl.
File metadata
- Download URL: jsonl2html-0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba75c86cc068ef398c023eec3f96d4a2de9879691280633ef55af68b273baceb
|
|
| MD5 |
499b0c1acf8d55ec3dcc62a754e43c55
|
|
| BLAKE2b-256 |
2c00b273798b099dbbb72fb25f4626e17d5b3dd600a38d90f0e94fe1bd8f9ce3
|