innmind/json

类型安全的 JSON 编码/解码器

1.4.0 2024-03-23 14:35 UTC

This package is auto-updated.

Last update: 2024-09-23 15:39:17 UTC


README

Build Status codecov Type Coverage

类型安全的 JSON 编码/解码器,目标是不要遗漏任何错误。

安装

composer require innmind/json

用法

use Innmind\Json\Json;

Json::encode(['foo' => 'bar']); // {"foo":"bar"}
Json::decode('{"foo":"bar"}'); // ['foo' => 'bar']
Json::decode('{]'); // will throw an exception (instead of returning false)