Skip to main content

JSON generation based on schema.

Project description

DJG

DJG is a simple library and cli tool generating JSON objects based on a given schema.

DJG is in very early development.

Currently supported features:

  • number
  • string
  • array
  • enum & const for each type

Installation

Install via pip

$ pip install djg

Usage

As Python module

from djg import gen_from_schema
import json

schema = {
    "type": "object",
    "properties": {
        "ProductIdentifier": {
            "type": "object",
            "properties": {
                "Name": {"type": "string", "pattern": "[a-zA-Z]{5,10}"},
                "Uid": {"type": "number", "minimum": 1000, "maximum": 100000},
            },
        },
        "ProductQuantity": {
            "type": "number",
            "minimum": 0,
            "maximum": 100,
        },
    },
}

json_object = gen_from_schema(schema)

CLI

djg --help

usage: djg.py [-h] -s SCHEMA_FILE [-o FILE]

djg - create random JSON objects based on a given schema.

options:
  -h, --help            show this help message and exit
  -s SCHEMA_FILE, --schema SCHEMA_FILE
                        JSON Schema loaction
  -o FILE, --output FILE
                        JSON output location - default is stdout

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

djg-0.1.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

djg-0.1.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file djg-0.1.1.tar.gz.

File metadata

  • Download URL: djg-0.1.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for djg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f95d592b99c3806d171a08e45f88f15bdc749eab62b752c9aeb8ff8a26f7ca2d
MD5 e27bbe513de1bf6f48018de0c56a2d76
BLAKE2b-256 6c4c76466d6ff49bd2054c798b6a0e6d56cc17021bf692e164160215e87b45cd

See more details on using hashes here.

File details

Details for the file djg-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: djg-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for djg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 191388a49377f1128ea52bcc70934658c86cd76f88a5190e28295ec00cdd36e7
MD5 c999a4eba640703c45c6c29fc1cbd046
BLAKE2b-256 cbfcc2195d6190bd1116848009dc48f89466640925ddc659660d733a5a009870

See more details on using hashes here.

Supported by

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