https://github.com/8ctopus/relaxed-json
Tired of JSON's super strict syntax? Then relaxed JSON if for you.
https://github.com/8ctopus/relaxed-json
json json-comments json-parsing
Last synced: 5 months ago
JSON representation
Tired of JSON's super strict syntax? Then relaxed JSON if for you.
- Host: GitHub
- URL: https://github.com/8ctopus/relaxed-json
- Owner: 8ctopus
- License: mit
- Created: 2023-08-31T06:49:41.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-26T09:52:58.000Z (over 1 year ago)
- Last Synced: 2025-05-08T02:40:35.392Z (about 1 year ago)
- Topics: json, json-comments, json-parsing
- Language: PHP
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# relaxed json
[](https://packagist.org/packages/8ctopus/relaxed-json)
[](https://packagist.org/packages/8ctopus/relaxed-json)
[](https://packagist.org/packages/8ctopus/relaxed-json)
[](https://packagist.org/packages/8ctopus/relaxed-json)
[](https://github.com/8ctopus/relaxed-json/actions/workflows/tests.yml)


Tired of JSON's super strict syntax? Then relaxed JSON if for you.
## features
- supports comments in all forms `// my comment`, `/* my comment */`
- ignores trailing commas at the end of an array or object
- throws an Exception when the json is invalid
- zero dependencies
## install
composer require 8ctopus/relaxed-json
## usage
```php
use Oct8pus\RelaxedJson;
$json = <<
string(20) "8ctopus/relaxed-json"
}
```
### exceptions
```php
$json = << 300,
}
JSON;
// throws RelaxedJsonException Syntax error
RelaxedJson::decode($json, true);
```
## credits
This library is are repack with improvements of the original work from [https://github.com/etconsilium/php-json-fix](https://github.com/etconsilium/php-json-fix)
## tests
composer test
## clean code
composer fix
composer fix-risky