在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:colinodell/json5开源软件地址:https://github.com/colinodell/json5开源编程语言:PHP 99.9%开源软件介绍:JSON5 for PHP - JSON for HumansThis library is a PHP fork of the JSON5 reference implementation. JSON5 is a JS-compatible extension to JSON which allows comments, trailing commas, single-quoted strings, and more: {
foo: 'bar',
while: true,
this: 'is a \
multi-line string',
// this is an inline comment
here: 'is another', // inline comment
/* this is a block comment
that continues on another line */
hex: 0xDEADbeef,
half: .5,
delta: +10,
to: Infinity, // and beyond!
finally: 'a trailing comma',
oh: [
"we shouldn't forget",
'arrays can have',
'trailing commas too',
],
} See the JSON5 website for additional examples and details. InstallVia Composer $ composer require colinodell/json5 UsageThis package adds a $json = file_get_contents('foo.json5');
$data = json5_decode($json); It takes the same exact parameters in the same order. For more details on these, see the PHP docs. To achieve the best possible performance, it'll try parsing with PHP's native function (which usually fails fast) and then falls back to JSON5. ExceptionsThis function will always throw a For users on PHP 7.2 and below: a PHP 7.3 polyfill is included with this library so that you can safely reference Binary / ExecutableA binary/executable named
Examples:Converting a file named file.json5: json5 file.json5 Converting a file and saving its output: json5 file.json5 > file.json Converting from STDIN: echo -e "{hello: 'world!'}" | json5 Converting from STDIN and saving the output: echo -e "{hello: 'world!'}" | json5 > output.json Change logPlease see CHANGELOG for more information on what has changed recently. Testing$ composer test ContributingPlease see CONTRIBUTING and CODE_OF_CONDUCT for details. SecurityIf you discover any security related issues, please email [email protected] instead of using the issue tracker. SupportIn addition to standard support, consider a Tidelift Subscription for professional support and get alerted when new releases or security issues come out. Credits
LicenseThe MIT License (MIT). Please see License File for more information. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论