Go to file
Maxim Kuleshov dd1c8ad1ba
Publish PHP Package / docker (push) Successful in 7s Details
v1.0.8
2024-03-21 16:15:11 +03:00
.gitea/workflows Добавить .gitea/workflows/build_composer.yaml 2024-02-13 14:52:33 +03:00
.gitignore Making PHPStan happy 2023-08-16 14:13:27 +03:00
CHANGELOG.md v1.0.8 2024-03-21 16:15:11 +03:00
README.md Обновить README.md 2024-03-14 17:38:02 +03:00
composer.json Adding composer.json 2022-05-16 14:36:37 +03:00
json.inc.php Making PHPStan happy 2023-08-18 13:13:48 +03:00
jzon.inc.php Parse number as floating-point if it doesn't fit in integer; try hard to use integer when possible though 2024-03-21 15:54:50 +03:00

README.md

PHP JZON

This is a small PHP library for parsing JZON documents.

What is JZON?

JZON is a superset of JSON which is designed to be actively edited by humans.

PHP JZON features:

  • no need to worry about trailing commas

  • one line comments starting with #

  • simple array keys don't need to be quoted with ""

  • parsing errors are shown in a friendly manner

Quick Example

Say, you have the following JZON file example.json:

["foo",
  "bar",
 {meaning_of_life: 42,
#NOTE: no comma ahead
#      and yes comments are supported!
   hey: "bar"
  "thatscool": 1
  }
]

Now you can parse it this way:

<?php

$str = file_get_contents('example.json');
var_dump(jzon_parse($str));

And it should output something as follows:

array(3) {
  [0]=>
  string(3) "foo"
  [1]=>
  string(3) "bar"
  [2]=>
  array(3) {
    ["thatscool"]=>
    int(1)
    ["meaning_of_life"]=>
    int(42)
    ["hey"]=>
    string(3) "bar"
  }
}