{"id":5439,"library":"python-json-config","title":"python-json-config","description":"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.","status":"maintenance","version":"1.2.3","language":"en","source_language":"en","source_url":"https://github.com/janehmueller/python-json-config","tags":["json","config","configuration","validation","dot-notation"],"install":[{"cmd":"pip install python-json-config","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for the library to run.","package":"python","version":">=3.6","optional":false}],"imports":[{"symbol":"ConfigBuilder","correct":"from python_json_config import ConfigBuilder"}],"quickstart":{"code":"import os\nimport tempfile\n\n# Create a dummy config.json for the example\nconfig_content = '''\n{\n    \"server\": {\n        \"host\": \"localhost\",\n        \"port\": 8080\n    },\n    \"database\": {\n        \"name\": \"mydb\",\n        \"user\": \"admin\"\n    },\n    \"jwt_secret\": \"${JWT_SECRET:-default_secret_key}\"\n}\n'''\n\nwith tempfile.TemporaryDirectory() as tmpdir:\n    config_path = os.path.join(tmpdir, 'config.json')\n    with open(config_path, 'w') as f:\n        f.write(config_content)\n\n    # Set an environment variable to demonstrate its use\n    os.environ['JWT_SECRET'] = 'my_super_secret_jwt_key'\n\n    from python_json_config import ConfigBuilder\n\n    # Create config parser\n    builder = ConfigBuilder()\n\n    # Parse config from the temporary file\n    config = builder.parse_config(config_path)\n\n    # Access elements using dot notation\n    host = config.server.host\n    port = config.server.port\n    db_name = config.database.name\n    jwt_secret = config.jwt_secret # This will pick up from os.environ\n\n    print(f\"Server Host: {host}\")\n    print(f\"Server Port: {port}\")\n    print(f\"Database Name: {db_name}\")\n    print(f\"JWT Secret: {jwt_secret}\")\n\n    # Validate field types\n    builder.validate_field_type('server.port', int)\n    builder.validate_field_type('database.user', str)\n    print(\"Configuration fields validated successfully.\")\n\n    # Clean up environment variable\n    del os.environ['JWT_SECRET']\n","lang":"python","description":"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."},"warnings":[{"fix":"Implement custom serialization/deserialization logic for non-standard types if strict type preservation is required.","message":"When 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.","severity":"gotcha","affected_versions":"<=1.2.3"},{"fix":"Consider evaluating alternatives if active development, feature updates, or support for the latest Python versions are critical for your project.","message":"The `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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Remove comments from JSON configuration files or preprocess them before parsing with `python-json-config`. For configuration that requires comments, consider formats like YAML or TOML.","message":"Standard 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`).","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}