Registry / serialization / jsonasobj

jsonasobj

JSON →
library1.3.1pypypi✓ verified 85d ago

A Python library for treating JSON data as Python objects, providing dict-like access with attribute-style syntax. Current version is 1.3.1 (stable) with v2.0.x pre-releases introducing breaking changes. Development is ongoing with pre-release versions.

pip install jsonasobj
INSTALL
IMPORT
SIG · JSONASOBJ
J
jsonasobj
serializationpythonv1.3.1
Install
1.5s avg
Import
117ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.2.dev4 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.123s · 17.9MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 1.5s · import 0.111s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

JsonObj
from jsonasobj import JsonObj
from jsonasobj2 import JsonObj
v2 renamed the package; v1 uses jsonasobj, v2 uses jsonasobj2

Basic usage creating a JsonObj and accessing attributes.

from jsonasobj import JsonObj data = JsonObj(name="test", count=42) print(data.name) # test print(data['count']) # 42
Debug
Known issues
breakingVersion 2 pre-releases (jsonasobj2) introduce a new package name and are not backwards compatible.
fix
Import from jsonasobj2 instead of jsonasobj, or pin to v1.3.1 for compatibility.
affects: >=2.0.0
deprecatedPython 2 support is deprecated in v1.3.x and completely removed in v2.
fix
Upgrade to Python 3 and use latest version.
affects: <2.0.0
gotchaJsonObj inherits from dict, but setting attributes via dot notation does not update the underlying dict keys.
fix
Use dict-style assignment (obj['key'] = value) to keep dict and attribute in sync.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'jsonasobj2'
Trying to import v2 under v1 package name.
fix
Use `from jsonasobj import JsonObj` for v1.x, or install v2 pre-release with `pip install jsonasobj==2.0.2dev4` and import from jsonasobj2.
AttributeError: 'JsonObj' object has no attribute 'from_json'
The method 'from_json' does not exist; a class method for construction from JSON string may have been removed.
fix
Use `JsonObj(json.loads(json_string))` instead.
Upgrade
Version history
1.3.1latest on PyPI · released Feb 8, 2021
Audit
Dependencies
sixrequiredUsed for Python 2/3 compatibility in version 1.x
Agent activity
6 hits · last 30 days
node
6
Resources
jsonasobj — pip install jsonasobj · libregistry