1. Go to this page and download the library: Download adhocore/json-comment library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
adhocore / json-comment example snippets
use Ahc\Json\Comment;
// The JSON string!
$someJsonText = '{"a":1,
"b":2,// comment
"c":3 /* inline comment */,
// comment
"d":/* also a comment */"d",
/* creepy comment*/"e":2.3,
/* multi line
comment */
"f":"f1",}';
// OR
$someJsonText = file_get_contents('...');
// Strip only!
(new Comment)->strip($someJsonText);
// Strip and decode!
(new Comment)->decode($someJsonText);
// You can pass args like in `json_decode`
(new Comment)->decode($someJsonText, $assoc = true, $depth = 512, $options = JSON_BIGINT_AS_STRING);
// Or you can use static alias of decode:
Comment::parse($json, true);
# Or use file directly
Comment::parseFromFile('/path/to/file.json', true);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.