{"id":16198522,"url":"https://github.com/colinodell/json5","last_synced_at":"2025-05-15T21:06:47.783Z","repository":{"id":26786435,"uuid":"110267929","full_name":"colinodell/json5","owner":"colinodell","description":"UTF-8 compatible JSON5 parser for PHP","archived":false,"fork":false,"pushed_at":"2024-07-17T23:42:37.000Z","size":208,"stargazers_count":275,"open_issues_count":0,"forks_count":10,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-10-29T22:51:29.785Z","etag":null,"topics":["hacktoberfest","json","json5","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/colinodell/json5","language":"PHP","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/colinodell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":"colinodell","patreon":"colinodell","custom":["https://www.colinodell.com/sponsor","https://www.paypal.me/colinpodell/10.00"]}},"created_at":"2017-11-10T16:24:51.000Z","updated_at":"2024-09-27T09:08:32.000Z","dependencies_parsed_at":"2024-11-09T18:00:28.677Z","dependency_job_id":null,"html_url":"https://github.com/colinodell/json5","commit_stats":{"total_commits":132,"total_committers":7,"mean_commits":"18.857142857142858","dds":0.06060606060606055,"last_synced_commit":"15b063f8cb5e6deb15f0cd39123264ec0d19c710"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinodell%2Fjson5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinodell%2Fjson5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinodell%2Fjson5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colinodell%2Fjson5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colinodell","download_url":"https://codeload.github.com/colinodell/json5/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254422761,"owners_count":22068678,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["hacktoberfest","json","json5","php"],"created_at":"2024-10-10T09:14:04.310Z","updated_at":"2025-05-15T21:06:47.747Z","avatar_url":"https://github.com/colinodell.png","language":"PHP","funding_links":["https://github.com/sponsors/colinodell","https://patreon.com/colinodell","https://www.colinodell.com/sponsor","https://www.paypal.me/colinpodell/10.00","https://tidelift.com/subscription/pkg/packagist-colinodell-json5?utm_source=packagist-colinodell-json5\u0026utm_medium=referral\u0026utm_campaign=readme"],"categories":[],"sub_categories":[],"readme":"# JSON5 for PHP - JSON for Humans\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![PHP 8.0+][ico-php]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-build-status]][link-build-status]\n[![Coverage Status][ico-scrutinizer]][link-scrutinizer]\n[![SensioLabs Insight][ico-sensio]][link-sensio]\n![UTF-8 Compatible][ico-utf8]\n[![Total Downloads][ico-downloads]][link-downloads]\n\n\nThis library is a PHP fork of the [JSON5 reference implementation][link-json5].\n\nJSON5 is a JS-compatible extension to JSON which allows comments, trailing commas, single-quoted strings, and more:\n\n\n```js\n{\n    foo: 'bar',\n    while: true,\n\n    this: 'is a \\\nmulti-line string',\n\n    // this is an inline comment\n    here: 'is another', // inline comment\n\n    /* this is a block comment\n       that continues on another line */\n\n    hex: 0xDEADbeef,\n    half: .5,\n    delta: +10,\n    to: Infinity,   // and beyond!\n\n    finally: [\n        'some trailing commas',\n    ],\n}\n```\n\n\n[See the JSON5 website for additional examples and details][link-json5-site].\n\n\n## Install\n\nVia Composer\n\n``` bash\ncomposer require colinodell/json5\n```\n\n## Usage\n\nThis package adds a `json5_decode()` function which is a drop-in replacement for PHP's built-in `json_decode()`:\n\n``` php\n$json = file_get_contents('foo.json5');\n$data = json5_decode($json);\n```\n\nIt takes the same exact parameters in the same order.  For more details on these, see the [PHP docs][link-php-jsondecode].\n\nTo achieve the best possible performance, it'll try parsing with PHP's native function (which usually fails fast) and then falls back to JSON5.\n\n### Exceptions\n\nThis function will **always** throw a `SyntaxError` exception if parsing fails.  This is a subclass of the new `\\JsonException` introduced in PHP 7.3.\nProviding or omitting the `JSON_THROW_ON_ERROR` option will have no effect on this behavior.\n\n## Binary / Executable\n\nA binary/executable named `json5` is also provided for converting JSON5 to plain JSON via your terminal.\n\n```\nUsage: json5 [OPTIONS] [FILE]\n\n  -h, --help  Shows help and usage information\n\n  (Reading data from STDIN is not currently supported on Windows)\n```\n\n### Examples:\n\nConverting a file named file.json5:\n\n```bash\njson5 file.json5\n```\n\nConverting a file and saving its output:\n\n```bash\njson5 file.json5 \u003e file.json\n```\n\nConverting from STDIN:\n\n```bash\necho -e \"{hello: 'world!'}\" | json5\n```\n\nConverting from STDIN and saving the output:\n```bash\necho -e \"{hello: 'world!'}\" | json5 \u003e output.json\n```\n\n## Change log\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) and [CODE_OF_CONDUCT](CODE_OF_CONDUCT.md) for details.\n\n## Security\n\nIf you discover any security related issues, please email colinodell@gmail.com instead of using the issue tracker.\n\n## Support\n\nIn addition to standard support, [consider a Tidelift Subscription for professional support and get alerted when new releases or security issues come out](https://tidelift.com/subscription/pkg/packagist-colinodell-json5?utm_source=packagist-colinodell-json5\u0026utm_medium=referral\u0026utm_campaign=readme).\n\n## Credits\n\n- [Colin O'Dell][link-author]\n- [Aseem Kishore][link-upstream-author], [the JSON5 project][link-json5], and [their contributors][link-upstream-contributors]\n- [All other contributors to this project][link-contributors]\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/colinodell/json5.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-build-status]: https://img.shields.io/github/actions/workflow/status/colinodell/json5/tests.yml?branch=main\u0026style=flat-square\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/colinodell/json5.svg?style=flat-square\n[ico-code-quality]: https://img.shields.io/scrutinizer/g/colinodell/json5.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/colinodell/json5.svg?style=flat-square\n[ico-utf8]: https://img.shields.io/badge/utf--8-compatible-brightgreen.svg?style=flat-square\n[ico-sensio]: https://img.shields.io/symfony/i/grade/920abb3b-a7d0-431a-bb5a-9831d142690e?style=flat-square\n[ico-php]: https://img.shields.io/packagist/php-v/colinodell/json5.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/colinodell/json5\n[link-build-status]: https://github.com/colinodell/json5/actions?query=workflow%3ATests+branch%3Amain\n[link-scrutinizer]: https://scrutinizer-ci.com/g/colinodell/json5/code-structure/main/code-coverage\n[link-code-quality]: https://scrutinizer-ci.com/g/colinodell/json5\n[link-downloads]: https://packagist.org/packages/colinodell/json5\n[link-sensio]: https://insight.symfony.com/projects/920abb3b-a7d0-431a-bb5a-9831d142690e\n[link-author]: https://github.com/colinodell\n[link-json5]: https://github.com/json5/json5\n[link-php-jsondecode]: http://php.net/manual/en/function.json-decode.php\n[link-upstream-author]: https://github.com/aseemk\n[link-upstream-contributors]: https://github.com/json5/json5#credits\n[link-json5-site]: http://json5.org\n[link-contributors]: https://github.com/colinodell/json5/graphs/contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinodell%2Fjson5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolinodell%2Fjson5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolinodell%2Fjson5/lists"}