Skip to content
/ jsonc Public

Providing parser of JSONC ( JSON with Comments ).

License

Notifications You must be signed in to change notification settings

cwola/jsonc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonc

PHP JSON with Comments(Cwola library).

Overview

Providing parser of JSONC(JSON with Comments) for PHP.

Requirement

  • PHP8.0+

Installation

composer require cwola/jsonc

Usage

<?php

$value = <<< JSONC
/**
 * JSON with Comments for PHP.
 * DOC BLOCK.
 */

// Line comment.

{
    "id": "xxx",  // Identify
    "name": "jhon doe"  // your name
    "age": 0,
    "keyword": [
        "xxx", 1, -5
    ]
}
JSONC;

$json = Cwola\Jsonc\decode($value);
echo $json['name'];  // jhon doe

echo Cwola\Jsonc\toJson($value);  // output json string

echo Cwola\Jsonc\toXml($value);  // output xml string

echo Cwola\Jsonc\toReadableAST($value);  // output Abstract Syntax Tree

Licence

MIT

About

Providing parser of JSONC ( JSON with Comments ).

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages