Skip to main content

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_stats package)

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 answers
  • examples/single_object.json: Single JSON object example
  • examples/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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonl2html-0.2.5.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonl2html-0.2.5-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file jsonl2html-0.2.5.tar.gz.

File metadata

  • Download URL: jsonl2html-0.2.5.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for jsonl2html-0.2.5.tar.gz
Algorithm Hash digest
SHA256 4ee45e9733314e15c99131b7e69a07919ad4e9e0c87e7f3d603369c223b554de
MD5 ea7d181ae9b3f29d0fac14db5ac1edbc
BLAKE2b-256 e70f441073130bec7aba72c6683421801f47eb951ff2e9473d8ad2be28a81963

See more details on using hashes here.

File details

Details for the file jsonl2html-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: jsonl2html-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for jsonl2html-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c80dbcd0584768957107741ec14903f7b4c9f57a99d4e9a9084508630d7581db
MD5 a0aea54c1348c473165a63beb5e16a23
BLAKE2b-256 d7406ac4110023165bfb6e3b75f16a5bc2fea622ae9d7349bdd97bd745876f74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page