Safely encode and decode JSON

Fund package maintenance!
ghostwriter

Installs: 1 385 123

Dependents: 8

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

3.0.0 2024-02-09 19:45 UTC

This package is auto-updated.

Last update: 2024-04-28 22:11:21 UTC


README

Compliance Supported PHP Version GitHub Sponsors Mutation Coverage Code Coverage Type Coverage Psalm Level Latest Version on Packagist Downloads

Safely encode and decode JSON

Installation

You can install the package via composer:

composer require ghostwriter/json

Star ⭐️ this repo if you find it useful

You can also star (🌟) this repo to find it easier later.

Usage

use \Ghostwriter\Json\Json;

$json = new Json();

$encode = $json->encode(['foo'=>'bar']);
// {"foo":"bar"}

$json->validate($encode); // true

$decode = $json->decode($encode);
// ['foo'=>'bar']

$prettyPrint = true;
$json->encode($decode, $prettyPrint); 
// {
//    "foo":"bar"
// }

Credits

Changelog

Please see CHANGELOG.md for more information on what has changed recently.

License

Please see LICENSE for more information on the license that applies to this project.

Security

Please see SECURITY.md for more information on security disclosure process.