2017 © Pedro Peláez
 

library json

A JSON encode/decode helper with easier error handling for PHP

image

tc/json

A JSON encode/decode helper with easier error handling for PHP

  • Friday, March 3, 2017
  • by carlcraig
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Tc Json

A JSON encode/decode helper with easier error handling for PHP, (*1)

Installation

composer require tc/json

Usage

<?php

use Tc\Json\Json;
use Tc\Json\JsonException;

$data = [
    'foo' => 'bar',
];

$jsonString = Json::encode($data); // {"foo": "bar"}

$jsonDataObject = Json::decode($jsonString); // ( [foo] => bar )

$jsonDataArray = Json::decode($jsonString, true ); // ['foo' => 'bar']

$jsonData = Json::decode($jsonString, true); // ['foo' => 'bar']

try {
    Json::decode('{"foo"'); // invalid json string
} catch(JsonException $e) {
    echo $e->getMessage(); // description of error
}

License

Tc Json is licensed with the MIT license., (*2)

See LICENSE for more details., (*3)

The Versions

03/03 2017

dev-master

9999999-dev https://github.com/carlcraig/tc-json

A JSON encode/decode helper with easier error handling for PHP

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Carl Craig

json encode decode

03/03 2017

v1.0.0

1.0.0.0 https://github.com/carlcraig/tc-json

A JSON encode/decode helper with easier error handling for PHP

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

by Carl Craig

json encode decode