Registry / serialization / python-json-config

python-json-config

JSON →
library1.2.3pypypi✓ verified 35d ago

This library (version 1.2.3) provides a convenient way to load JSON configuration files, allowing access to values using dot notation (e.g., `config.server.port`). It also includes features for validating config field types and values, and transforming fields. The library's last update was in November 2019, indicating a maintenance-only or inactive release cadence.

serialization
Install & Compatibility
Where this runs
tested against v1.2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.262s · 22.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.5s · import 0.244s · 23MB
21MB installed
● package 21MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from python_json_config import ConfigBuilder

This quickstart demonstrates how to initialize `ConfigBuilder`, parse a JSON configuration file, and access nested values using convenient dot notation. It also includes an example of validating field types and how environment variables can be used for configuration values.

import os import tempfile # Create a dummy config.json for the example config_content = ''' { "server": { "host": "localhost", "port": 8080 }, "database": { "name": "mydb", "user": "admin" }, "jwt_secret": "${JWT_SECRET:-default_secret_key}" } ''' with tempfile.TemporaryDirectory() as tmpdir: config_path = os.path.join(tmpdir, 'config.json') with open(config_path, 'w') as f: f.write(config_content) # Set an environment variable to demonstrate its use os.environ['JWT_SECRET'] = 'my_super_secret_jwt_key' from python_json_config import ConfigBuilder # Create config parser builder = ConfigBuilder() # Parse config from the temporary file config = builder.parse_config(config_path) # Access elements using dot notation host = config.server.host port = config.server.port db_name = config.database.name jwt_secret = config.jwt_secret # This will pick up from os.environ print(f"Server Host: {host}") print(f"Server Port: {port}") print(f"Database Name: {db_name}") print(f"JWT Secret: {jwt_secret}") # Validate field types builder.validate_field_type('server.port', int) builder.validate_field_type('database.user', str) print("Configuration fields validated successfully.") # Clean up environment variable del os.environ['JWT_SECRET']
Debug
Known footguns
gotchaWhen serializing a `Config` object to JSON or msgpack, non-serializable Python objects (e.g., `datetime` objects) will be stringified. This can lead to loss of original data type upon deserialization if not explicitly handled.
gotchaThe `python-json-config` library has not seen updates since November 2019 (version 1.2.3). This indicates a lack of active development, which might mean no new features, limited official support for newer Python versions beyond 3.6, or unaddressed bugs/security concerns. Users should be aware of its maintenance status.
gotchaStandard JSON format does not officially support comments. While the library parses JSON, including comments in your `.json` configuration files will result in parsing errors (e.g., `json.decoder.JSONDecodeError`).
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
16 hits · last 30 days
gptbot
4
ahrefsbot
4
dotbot
3
bytedance
3
script
1
mj12bot
1
Resources