Skip to main content

Convert JSON API responses to YAML schema

Project description

JSON to YAML Schema Converter

A powerful Python tool that converts JSON API responses into YAML schema format with proper type definitions, titles, and format specifications.

Features

  • Smart Type Detection: Automatically detects and maps JSON types to schema types
  • Date-Time Recognition: Identifies datetime strings and adds format: date-time, format: epoch-millis, format: uuid, format: ip-addr, format: mac-addr, format: url, format: uri
  • Nested Object Support: Handles complex nested JSON structures
  • Array Processing: Properly processes arrays and their item types
  • Title Generation: Creates human-readable titles from JSON keys
  • CLI Interface: Easy-to-use command-line interface
  • Batch Processing: Convert multiple JSON files at once

Your api response file should look like this e.g

All json file should be build/output inside the folder or response would be like below

[
    {
        "id": 12345,
        "name": "test Innovations Corp",
        "legal_name": "Tech Innovations Corporation Inc.",
        "founded_date": "2020-01-15",
        "incorporation_date": "2020-01-15T09:00:00Z",
        "tax_id": "12-3456789",
        "website": "https://testinnovations.com",
        "industry": "Software Technology",
        "employee_count": 250,
        "annual_revenue": 15000000.75,
        "is_public": true,
        "stock_symbol": null
    },
    {
        "id": 4565,
        "name": "demo Innovations Corp",
        "legal_name": "demo Innovations Corporation Inc.",
        "founded_date": "2020-01-15",
        "incorporation_date": "2020-01-15T09:00:00Z",
        "tax_id": "12-3456789",
        "website": "https://testinnovations.com",
        "industry": "Software Technology",
        "employee_count": 250,
        "annual_revenue": 15000000.75,
        "is_public": true,
        "stock_symbol": null
    },
]

Command Line Interface (CLI)

# Use custom input folder
json2yaml_schema --folder my_api_data_folder

Python API Usage

from json_yaml_schema_converter import JSONToYAMLConverter

# Initialize converter
converter = JSONToYAMLConverter("path/to/json/files")

# Convert all JSON files
converted_files = converter.process_all_json_files()

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_yaml_schema_converter-0.6.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

json_yaml_schema_converter-0.6.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file json_yaml_schema_converter-0.6.0.tar.gz.

File metadata

File hashes

Hashes for json_yaml_schema_converter-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d13769ecc5617a6a364cf16b303e112696282a57e8761c6e39666d87a86c868d
MD5 76acdc5df2d8f36513583656d01ead7f
BLAKE2b-256 088dd9fcb081f9d4d70faab3b1d919fb12937377769d5c78f0a3985f1b5b20c5

See more details on using hashes here.

File details

Details for the file json_yaml_schema_converter-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for json_yaml_schema_converter-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b74595c247cafd58b4f0d0354a1164f1c9d8103847b4eec342dbc12212d97be
MD5 64c400f7a04228d3b7054eb7e57b3279
BLAKE2b-256 ac83d3cf11be26b2740254770a59b8e3fb605c202dac01129ed8c3e15076ec46

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