{"id":37710551,"url":"https://github.com/austinyu/ujson5","last_synced_at":"2026-01-16T13:18:27.522Z","repository":{"id":276569886,"uuid":"929146008","full_name":"austinyu/ujson5","owner":"austinyu","description":"A fast JSON5 encoder/decoder for Python","archived":false,"fork":false,"pushed_at":"2025-04-16T18:47:47.000Z","size":1266,"stargazers_count":42,"open_issues_count":4,"forks_count":9,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-08-25T18:56:59.349Z","etag":null,"topics":["json5","parser","python"],"latest_commit_sha":null,"homepage":"https://austinyu.github.io/ujson5/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/austinyu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-07T22:23:19.000Z","updated_at":"2025-04-15T23:00:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"01ffc791-938c-48e8-9fa1-de224ab5624d","html_url":"https://github.com/austinyu/ujson5","commit_stats":null,"previous_names":["austinyu/pyjson5","austinyu/pyjp5","austinyu/ujson5"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/austinyu/ujson5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinyu%2Fujson5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinyu%2Fujson5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinyu%2Fujson5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinyu%2Fujson5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austinyu","download_url":"https://codeload.github.com/austinyu/ujson5/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austinyu%2Fujson5/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28479008,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json5","parser","python"],"created_at":"2026-01-16T13:18:27.457Z","updated_at":"2026-01-16T13:18:27.511Z","avatar_url":"https://github.com/austinyu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ujson5\n\n[Documentation](https://austinyu.github.io/ujson5/)\n\n|                 |  |\n|------------------------|--------|\n| CI/CD  | [![CI](https://github.com/austinyu/ujson5/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/austinyu/ujson5/actions/workflows/CI.yml) \u003cbr\u003e [![build docs](https://github.com/austinyu/ujson5/actions/workflows/docs.yml/badge.svg)](https://github.com/austinyu/ujson5/actions/workflows/docs.yml)   |\n| Coverage / Codspeed      | [![codecov](https://codecov.io/gh/austinyu/ujson5/graph/badge.svg?token=YLMVKROAF2)](https://codecov.io/gh/austinyu/ujson5) \u003cbr\u003e[![CodSpeed Badge](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://codspeed.io/austinyu/ujson5)     |\n| Package | ![PyPI - Version](https://img.shields.io/pypi/v/ujson5) \u003cbr\u003e ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ujson5) \u003cbr\u003e ![PyPI - License](https://img.shields.io/pypi/l/ujson5)  \u003cbr\u003e ![PyPI - Downloads](https://img.shields.io/pypi/dm/ujson5)     |\n| Meta  | [![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit\u0026logoColor=white)](https://github.com/pre-commit/pre-commit) \u003cbr\u003e [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) \u003cbr\u003e [![Checked with mypy](https://img.shields.io/badge/mypy-checked-blue)](http://mypy-lang.org/) |\n\n\n`ujson5` is a Python that encodes and decodes [JSON5](https://json5.org/), a superset of JSON that supports many human-friendly features such as comments, trailing commas, and more!\n\n## Why use JSON5?\n\nDirect quote from the [JSON5 website](https://json5.org/):\n\nJSON5 was started in 2012, and as of 2022, now gets **[\u003e65M downloads/week](https://www.npmjs.com/package/json5)**,\nranks in the **[top 0.1%](https://gist.github.com/anvaka/8e8fa57c7ee1350e3491)** of the most depended-upon packages on npm,\nand has been adopted by major projects like\n**[Chromium](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/runtime_enabled_features.json5;drc=5de823b36e68fd99009a29281b17bc3a1d6b329c),\n[Next.js](https://github.com/vercel/next.js/blob/b88f20c90bf4659b8ad5cb2a27956005eac2c7e8/packages/next/lib/find-config.ts#L43-L46),\n[Babel](https://babeljs.io/docs/en/config-files#supported-file-extensions),\n[Retool](https://community.retool.com/t/i-am-attempting-to-append-several-text-fields-to-a-google-sheet-but-receiving-a-json5-invalid-character-error/7626),\n[WebStorm](https://www.jetbrains.com/help/webstorm/json.html),\nand [more](https://github.com/json5/json5/wiki/In-the-Wild)**.\nIt's also natively supported on **[Apple platforms](https://developer.apple.com/documentation/foundation/jsondecoder/3766916-allowsjson5)**\nlike **macOS** and **iOS**.\n\n## Why use ujson5?\n\n- **Gentle learning curve** - If you know how to use the `json` module in Python, you already know how to use `ujson5`. `ujson5` API is almost identical to the `json` module with some additional features.\n- **Robust test suite** - `ujson5` is tested against the most famous JSON5 test suite to ensure compatibility. See the testing section for more information.\n- **Speed** - `ujson5` tokenizer and parser implement DFA-based algorithms for fast parsing, which is only slightly slower than the built-in `json` module.\n- **Pythonic** - Comments in python are directly encoded into JSON5 comments. Magic!\n- **Quality code base** - `ujson5` is linted with `flake8`, formatted with `black`, and type-checked with `mypy`. What's more? 100% test coverage with `pytest` and `codecov`!\n- **Friendly Error Messages** - `ujson5` provides detailed error messages to help you debug your JSON5 files, including the exact location of the error.\n- **Type hints** - `ujson5` provides type hints for all public functions and classes.\n\n## Installation\n\n```bash\npip install ujson5\n```\n\n\n## Quick Start\n\nYou can use `ujson5` just like the built-in `json` module. Here is a quick example:\n\n```python\nfrom typing import TypedDict\nimport ujson5\n\n# Decode JSON5\njson5_str = \"\"\"\n{\n  // comments\n  key: 'value', // trailing comma\n}\n\"\"\"\n\ndata = ujson5.loads(json5_str)\nprint(data)  # {'key': 'value'}\n\n\n# Encode JSON5\nclass Data(TypedDict):\n    # multiple long comments\n    # are supported\n    key: str  # inline comment\n\n\ndata = {\"key\": \"value\"}\njson5_str = ujson5.dumps(data, Data, indent=2)\nprint(json5_str)\n# {\n#   // multiple long comments\n#   // are supported\n#   \"key\": \"value\",  // inline comment\n# }\n\n```\n\n## CLI Usage\n\nAfter installing `ujson5`, you can use the `ujson5` command-line interface to convert JSON5 files to JSON files or simply validate JSON5 files. The CLI interface is the same as the [official JSON5 CLI](https://json5.org/).\n\n### Installation\n\nMake sure you have installed the package in these three ways to use the CLI:\n\n- Install using pipx (recommended): `pipx install ujson5`\n- Install to the global interpreter: `pip install ujson5`\n- Install to a virtual env and activate it.\n\n### Usage\n\n`ujson5` module can be used as a console script. The basic usage is:\n\n```bash\nujson5 \u003cinfile\u003e \u003coutfile\u003e [options]\n```\n\nIf the optional `infile` and `outfile` arguments are not specified, `sys.stdin` and `sys.stdout` will be used respectively:\n\n```bash\necho '{\"json\": \"obj\"}' | ujson5\n{\n    \"json\": \"obj\"\n}\n```\n\nOptions:\n\n- `infile`: The JSON5 file to be validated or converted to JSON. If not specified, read from `sys.stdin`.\n- `outfile`: The JSON file to output the converted JSON. If not specified, output to `sys.stdout`.\n- `-v`, `--version`: Print the version number.\n- `-i`, `--info`: Print the version number and system information.\n- `--sort-keys`: Sort the output of dictionaries alphabetically by key.\n- `--no-ensure-ascii`: Disable escaping of non-ascii characters, see [ujson5.dumps()][ujson5.dumps] for more information.\n- `--indent`, `--no-indent`, `--compact`: Mutually exclusive options for whitespace control.\n\n- `-h`, `--help`: Output usage information\n\n## Testing\n\n`ujson5` is tested against fixtures in the [JSONTestSuite](https://github.com/nst/JSONTestSuite), [nativejson-benchmark](https://github.com/miloyip/nativejson-benchmark), and [json5-tests](https://github.com/json5/json5-tests) repositories. It is tested to not crash against the [Big List of Naughty Strings](https://github.com/minimaxir/big-list-of-naughty-strings).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustinyu%2Fujson5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustinyu%2Fujson5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustinyu%2Fujson5/lists"}