{"id":21484,"library":"json-five","title":"json-five","description":"A JSON5 parser and serializer for Python that supports round-trip preservation of comments, identifiers, and formatting. Current version 1.1.2, with a release cadence of a few months. Requires Python >=3.8.","status":"active","version":"1.1.2","language":"python","source_language":"en","source_url":"https://github.com/spyoungtech/json-five","tags":["json5","comments","round-trip","parser","serialization"],"install":[{"cmd":"pip install json-five","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Parser implementation dependency, with compatibility fixed in v0.8.0","package":"sly","optional":false}],"imports":[{"wrong":"from json_five.codec import JSON5Codec","symbol":"load","correct":"from json5 import load"},{"symbol":"loads","correct":"from json5 import loads"},{"symbol":"dump","correct":"from json5 import dump"}],"quickstart":{"code":"from json_five import loads, dumps\n\n# Parse JSON5 string (supports comments, trailing commas, etc.)\ndata = '''{\n  \"name\": \"Alice\",\n  // This is a comment\n  \"age\": 30,\n}'''\nparsed = loads(data)\nprint(parsed)  # {'name': 'Alice', 'age': 30}\n\n# Round-trip with comments preserved (using codec)\nfrom json_five.codec import JSON5Codec\ncodec = JSON5Codec()\nobj = codec.decode(data)\nprint(codec.encode(obj)) # includes comments\n\n# Dump without indentation (default)\nprint(dumps(parsed))  # {\"name\":\"Alice\",\"age\":30}\n\n# Dump with indentation\nprint(dumps(parsed, indent=2))","lang":"python","description":"Basic usage: parse JSON5 string, round-trip with comments, and dump with indentation."},"warnings":[{"fix":"Upgrade Python to 3.8 or later.","message":"In v1.0.0, support for Python 3.6 and 3.7 was dropped. Python >=3.8 is required.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use `json_five.codec.JSON5Codec` for round-trip comment preservation.","message":"The `loads` and `dumps` functions return plain Python objects by default, not the comment-preserving model. To preserve comments, use `JSON5Codec.decode/encode`.","severity":"gotcha","affected_versions":"all"},{"fix":"If you rely on `isinstance(x, str)` checks, note that `JsonIdentifier` now passes. To disable parsing of identifiers, pass `parse_json5_identifiers=False`.","message":"JSON5 identifiers (e.g. unquoted keys like `{foo: 1}`) are parsed as `JsonIdentifier` objects, which inherit from `str` since v1.0.0. Before v1.0.0, they were `UserString` subclasses, which could break code that expects `str`-only behavior.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use `from json_five import loads, dumps` instead of `from json_five.codec import loads, dumps`.","message":"The `codec` module's `loads` and `dumps` are still available but importing them from `json_five` is the recommended API.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.2':24 '3.8':35 'cadenc':28 'comment':18,37 'current':22 'five':3 'format':21 'identifi':19 'json':2 'json-fiv':1 'json5':5,36 'month':32 'parser':6,41 'preserv':16 'python':10,34 'releas':27 'requir':33 'round':14,39 'round-trip':13,38 'serial':8,42 'support':12 'trip':15,40 'version':23","created_at":"2026-04-27T17:00:08.506932+00:00","updated_at":"2026-04-27T17:00:08.506932+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.1.2","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/spyoungtech/json-five","docs":null,"changelog":null,"pypi":"https://pypi.org/project/json-five/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}