{"id":21491,"library":"jsonasobj2","title":"jsonasobj2","description":"Python library for converting JSON to Python objects and back, version 2. Current version 1.0.4, updated June 2023. Active development with infrequent releases.","status":"active","version":"1.0.4","language":"python","source_language":"en","source_url":"https://github.com/hsolbrig/jsonasobj2","tags":["json","objects","serialization"],"install":[{"cmd":"pip install jsonasobj2","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"jsonasobj (v1) is a separate library; jsonasobj2 changed the import path.","wrong":"from jsonasobj import JsonObj","symbol":"JsonObj","correct":"from jsonasobj2 import JsonObj"}],"quickstart":{"code":"from jsonasobj2 import JsonObj\n\n# Create a JsonObj from a dict\ndata = {'name': 'Alice', 'age': 30}\nobj = JsonObj(**data)\nprint(obj.name)  # Alice\nprint(obj.as_json())  # '{\"name\": \"Alice\", \"age\": 30}'\n\n# Convert JSON string to JsonObj\njson_str = '{\"key\": \"value\"}'\nobj2 = JsonObj.from_json(json_str)\nprint(obj2.key)  # value","lang":"python","description":"Create and manipulate JSON objects using attribute access. JsonObj wraps dict and allows dot notation."},"warnings":[{"fix":"Replace 'import jsonasobj' with 'from jsonasobj2 import JsonObj'.","message":"The old jsonasobj library is deprecated. Use jsonasobj2 for new projects.","severity":"deprecated","affected_versions":"all"},{"fix":"Use obj['class'] or setattr(obj, 'class', value) if needed.","message":"JsonObj does not support attribute names that are Python reserved words (e.g., 'class'). Use dict access instead.","severity":"gotcha","affected_versions":"all"},{"fix":"Assign the result: obj = JsonObj.from_json(json_string).","message":"JsonObj.from_json() is a class method that returns a new JsonObj. It does not modify the existing instance.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use: from jsonasobj2 import JsonObj","cause":"Installed jsonasobj2 but tried to import 'jsonasobj' (v1).","error":"ModuleNotFoundError: No module named 'jsonasobj'"},{"fix":"Use JsonObj.from_json(json_string) as a class method.","cause":"Calling from_json() on an instance instead of the class.","error":"AttributeError: 'JsonObj' object has no attribute 'from_json'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}