markup/json

Json wrapper to provide a more robust Api (matching 7.3 where possible)

Installs: 29 394

Dependents: 2

Suggesters: 0

Security: 0

Stars: 3

Watchers: 5

Forks: 1

Open Issues: 1

pkg:composer/markup/json

0.1.3 2019-02-28 14:09 UTC

This package is auto-updated.

Last update: 2025-10-10 09:22:11 UTC


README

Build Status

Json wrapper to provide a more robust API matching PHP 7.3 with exceptions rather than errors.

The following json options are always used

  • JSON_UNESCAPED_UNICODE
  • JSON_BIGINT_AS_STRING
  • JSON_THROW_ON_ERROR

Usage

try {
    $json = '{"a":1}';
    $data = Encoder::decode($json);

    $json = Encoder::encode($data);
} catch (\JsonException $exception) {
    echo $exception->getMessage(); // echoes "Syntax error"
}

Reference

Similar Packages