Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: about 2 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 (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-26T14:31:38.000Z (5 months ago)
- Last Synced: 2024-07-26T16:17:08.500Z (5 months ago)
- Topics: json, json-comments, json-parsing
- Language: PHP
- Homepage:
- Size: 18.6 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
[![packagist](https://poser.pugx.org/8ctopus/relaxed-json/v)](https://packagist.org/packages/8ctopus/relaxed-json)
[![downloads](https://poser.pugx.org/8ctopus/relaxed-json/downloads)](https://packagist.org/packages/8ctopus/relaxed-json)
[![min php version](https://poser.pugx.org/8ctopus/relaxed-json/require/php)](https://packagist.org/packages/8ctopus/relaxed-json)
[![license](https://poser.pugx.org/8ctopus/relaxed-json/license)](https://packagist.org/packages/8ctopus/relaxed-json)
[![tests](https://github.com/8ctopus/relaxed-json/actions/workflows/tests.yml/badge.svg)](https://github.com/8ctopus/relaxed-json/actions/workflows/tests.yml)
![code coverage badge](https://raw.githubusercontent.com/8ctopus/relaxed-json/image-data/coverage.svg)
![lines of code](https://raw.githubusercontent.com/8ctopus/relaxed-json/image-data/lines.svg)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