Skip to main content

json-build

json-build is a package that allows developers to build and save JSON files quickly.

Installation

pip install json-build

Create a new JSON object to build upon

from json_build import JSON_Object

new_json = JSON_Object(outer=[])

# 'outer' argument is optional
# if 'outer=[]' is passed it will wrap the JSON object in an array (Python list)
# otherwise, it will be a JSON object (Python dictionary)

Nest objects inside the JSON object

new_json.add_object(
    unique_name="people", 
    keyword="people", 
    data={},
    )

new_json.add_object(
    unique_name = 'person_1',
    keyword = 'person1',
    data = {"first_name": "Michael", "last_name": "Myers"},
    parent='people',
)

new_json.add_object(
    unique_name = 'relative_1',
    keyword = 'relative',
    data = {"first_name": "Laurie", "last_name": "Strode", "relation": "Sister"},
    parent = 'person_1'
)

new_json.add_object(
    unique_name = 'person_2',
    keyword = 'person2',
    data = {"first_name": "Jason", "last_name": "Voorhees"},
    parent='people',
)

new_json.add_object(
    unique_name = 'relative_2',
    keyword = 'relative',
    data = {"first_name": "Pamela", "last_name": "Voorhees", "relation": "Mother"},
    parent = 'person_2'
)

new_json.add_object(
    unique_name = 'movies',
    keyword = 'movies',
    data = [
        'Halloween',
        'Friday the 13th',
        'Nightmare on Elm Street',
    ],
)

# 'parent' argument is optional; if unpassed, the object will be added to the JSON object's first level
# Note that 'parent' uses the unique_name of the parent object, and not the keyword

Create the JSON object

new_json.create()

Save the JSON object to a file

new_json.save(file_name="killer_names", location_path="C:/Users/fkrueger/Desktop/")

# 'location_path' argument is optional; if unpassed it will save the file to the root of your local project

Resultant JSON object

[
    {
        "people": {
            "person1": {
                "first_name": "Michael",
                "last_name": "Myers",
                "relative": {
                    "first_name": "Laurie",
                    "last_name": "Strode",
                    "relation": "Sister"
                }
            },
            "person2": {
                "first_name": "Jason",
                "last_name": "Voorhees",
                "relative": {
                    "first_name": "Pamela",
                    "last_name": "Voorhees",
                    "relation": "Mother"
                }
            }
        },
        "movies": [
            "Halloween",
            "Friday the 13th",
            "Nightmare on Elm Street"
        ]
    }
]

Metadata

Release files for json-build 1.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for json-build 1.0.12
File Size Uploaded
json-build-1.0.12.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for json-build 1.0.12
File Interpreter ABI Platform
json_build-1.0.12-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / json-build-1.0.12.tar.gz

Download URL json-build-1.0.12.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6f4b29426fd6e99370a5db18429daf804944446ac5add4eeaef4f277523f9671
BLAKE2b-256 checksum
How to use checksums
5a3d44b83d8b0f297ed3dc37dae5d75630dc5782d6a017955ea074c247c26325
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / json_build-1.0.12-py3-none-any.whl

Download URL json_build-1.0.12-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
813bcfed8ffe4eb46cb347fb7f287657a908f7b6291bb163e4fe99d35dfb6ea4
BLAKE2b-256 checksum
How to use checksums
77d354d3dfbee5ec58fa2dfcb7f5b50f3d56785bb619c5efb9c0d0262d7fce92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

1.0.12 This release

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.0.31

2 release files

0.0.30

2 release files

0.0.29

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.22

2 release files

0.0.21

2 release files

0.0.20

2 release files

0.0.17

2 release files

0.0.15

2 release files

0.0.14

1 release file

0.0.13

1 release file

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page