2017 © Pedro Peláez
 

library json

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

image

markup/json

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

  • Monday, July 9, 2018
  • by gsdev
  • Repository
  • 2 Watchers
  • 0 Stars
  • 396 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Json

Build Status, (*1)

Json wrapper to provide a more robust API matching PHP 7.3 with exceptions rather than errors., (*2)

The following json options are always used, (*3)

  • 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

  • https://wiki.php.net/rfc/json_throw_on_error
  • https://ayesh.me/Upgrade-PHP-7.3#json-exceptions
  • https://github.com/php/php-src/blob/master/ext/json/json.c#L257

Similar Packages

  • https://github.com/webmozart/json
  • https://github.com/DaveRandom/ExceptionalJSON
  • https://github.com/symfony/serializer/blob/master/Encoder/JsonEncoder.php

The Versions

09/07 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Development Requires

by Gavin Staniforth

09/07 2018

dev-ci/allow-nightly-to-fail

dev-ci/allow-nightly-to-fail

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

  Sources   Download

MIT

The Development Requires

by Gavin Staniforth

13/06 2018

0.1

0.1.0.0

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

  Sources   Download

MIT

The Development Requires

by Gavin Staniforth