Skip to main content

Creates a JSON file of the Library of Congress Classification system

Project description

Library of Congress Classification to JSON

lcc2json outputs a single JSON file of the Library of Congress Classification system.

For input, it downloads 699 .json files, 14 megabytes in total, from the Library of Congress.

Install

Install from PyPI:

pip install lcc2json

Or install from main source repo, such as:

git clone https://spacecruft.org/books/lcc2json
cd lcc2json/
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -e .

Usage

Thusly.

Download the source JSON files from the Library of Congress

lcc2json-dl

Parse the downloaded JSON files and output a single JSON file:

lcc2json

Help

Download script help:

$ lcc2json-dl --help
usage: lcc2json-dl [-h] [-o OUTPUT_DIR] [-v] [--dry-run]

Download Library of Congress Classification JSON files from id.loc.gov

options:
  -h, --help            show this help message and exit
  -o, --output-dir OUTPUT_DIR
                        Output directory for JSON files (default: json)
  -v, --verbose         Enable verbose logging
  --dry-run             Show what would be downloaded without actually downloading

Examples:
  lcc2json-dl                     # Download all classifications to ./json/
  lcc2json-dl -o lcc_data         # Download to ./lcc_data/
  lcc2json-dl -v                  # Verbose output
  lcc2json-dl --dry-run           # Show what would be downloaded

Output JSON script help:

$ lcc2json --help
usage: lcc2json [-h] [-i INPUT_DIR] [-o OUTPUT] [-v] [--ranges]

Extract LCC outlines from downloaded JSON files.

options:
  -h, --help            show this help message and exit
  -i, --input-dir INPUT_DIR
                        Directory containing JSON files (default: json)
  -o, --output OUTPUT   Output file path (default: lcc.json)
  -v, --verbose         Enable verbose output
  --ranges              Include start/stop/prefix range fields in output (larger file size)

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Copyright © 2025 Jeff Moe

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

lcc2json-1.0.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

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

lcc2json-1.0.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file lcc2json-1.0.1.tar.gz.

File metadata

  • Download URL: lcc2json-1.0.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lcc2json-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b530c69291c0198aee1a40ef93cb9667873b7c5b3760b124f2c523249b4c9885
MD5 87e6ab4ba190b7825a0e296d4ff6374a
BLAKE2b-256 dbbf41aaac53f998c8fbf98945a70f5b47c35d57404b162eb5b5ce1847be5205

See more details on using hashes here.

File details

Details for the file lcc2json-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: lcc2json-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for lcc2json-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a8b52d5649aefe8f351b8f36f96ee47f48ce1e1e89cdd75c1a974181aa54110
MD5 1f991cecebdcfc45a36c8ece5058da1d
BLAKE2b-256 8447f3d03e11c4e4b9e72f9c4bca384f4f196cd0b7f631499544a8f7b063387e

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