Skip to main content

Adjsoned

This Python library can help you easily load your program's configuration/properties from a json file to a Python runtime object making key-value data accessible via python's "." syntax—as these key-value pairs were fields of this object.

Installation

pip install adjsoned

Get started

Instantiate a FileJsonProperties object giving it your config file's path and it will just work:

from adjsoned import FileJsonProperties


properties = FileJsonProperties(filepath="examples/some_properties.json")

# We can now access key-value/arrays data stored in our JSON file the following way:
# (NB: the ROOT element of your JSON file MUST be a DICT!)

if properties.debug_mode:
    print("We're in debug mode!")
    print("P.S. Properties told me that :)")

# 'properties' is an instance of FileJsonProperties (as well as JsonProperties — a parent class)
# 'properties.app_version' is also a JsonProperties instance, so we can access its fields like that:
print(properties.app_version.code)  # prints '4.1.2'

# arrays are interpreted as regular Python lists, you can just normally iterate through them:
for section in properties.project_settings.ignored_sections:
    print("Ignoring section", section)

# if an array element is a dictionary, it gets interpreted as a JsonProperties object as well:
print(properties.messages[1].title)  # prints: 'Hello again.'

The JSON file used in this example:

{
  "debugMode": true,

  "appVersion": {
    "code": "4.1.2",
    "build": 2
  },

  "projectSettings": {
    "frameRate": 60,
    "ignoredSections": [2, 6, 9]
  },

  "messages": [
    {
      "title": "Hello!",
      "description": "This is the first message."
    },
    {
      "title": "Hello again.",
      "description": "This is the second one. Nice to see you again!"
    }
  ]
}

Metadata

Release files for adjsoned 0.0.4

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

Source distribution (sdist)

Source distribution for adjsoned 0.0.4
File Size Uploaded Provenance
adjsoned-0.0.4.tar.gz 4.0 kB Without provenance Details

Release files / adjsoned-0.0.4.tar.gz

Download URL adjsoned-0.0.4.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d42235558500206c5fe244dd4902f6adcf0b15a20c0c1e508d5ed1981a1d188d
BLAKE2b-256 checksum
How to use checksums
d0e5cff9c556d8ae7c1fac84da97d7c7085008e69a5999802aa9e8936001fb3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Security for adjsoned 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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