Skip to main content

Useful tool for mapping out dataclasses based on JSON structure with typing

Project description

JSON to Dataclass

Just a simple tool that creates dataclasses from JSON files by assessing the JSON schema structure and building typed dataclasses into a .py file

Requirements


Python 3.12

Installation


pip install json_to_dataclass

Command Syntax


cd {DIRECTORY} $ python json_to_dataclass.py -h

  -h, --help            show this help message and exit
  -i INPUT, --input INPUT
                        Direct system path to a JSON file (default: ${CWD}/sample.json)
  -o OUTPUT, --output OUTPUT
                        Directory the place output .py file with Dataclass (default: ${CWD}/sample.py)
  -d DIRECTORY, --directory DIRECTORY
                        Directory to JSON files, will parse all files within into data classes. (default: ${CWD}/sample.json)
  -n NAME, --name NAME  Name of parent Dataclass (default: GeneratedDataclass)
  -ad APPLY_DEFAULTS, --apply_defaults APPLY_DEFAULTS
                        Apply default values for all fields using the values within provided JSON file (default: None)

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

json_to_dataclass-1.0.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

json_to_dataclass-1.0.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file json_to_dataclass-1.0.0.tar.gz.

File metadata

  • Download URL: json_to_dataclass-1.0.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.0

File hashes

Hashes for json_to_dataclass-1.0.0.tar.gz
Algorithm Hash digest
SHA256 87bd42ca5ea1c18ac0631eefcf02a5615b7da3f0a34587d0f98cfd3db5604807
MD5 b80f58b3042ae99e7e51727ae0292f3f
BLAKE2b-256 0db58944042863b420c8d03d3174262efa0c83b5bc290395e613d3ce76d10f41

See more details on using hashes here.

File details

Details for the file json_to_dataclass-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for json_to_dataclass-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d56edcbe346d4a6bf6345a7783ebd5d47a699b07cac3b95db828e41202e5f5e0
MD5 047e95c5487bbc3161bfc1fdd6a0108c
BLAKE2b-256 fe706265d603958d711b935c68f551a8baba5dec4df4129b5299f37eaf3399a6

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