midnite81/json-parser

A PHP JSON parser with Error Control

v1.0.1 2020-02-15 21:42 UTC

This package is auto-updated.

Last update: 2024-11-16 08:06:56 UTC


README

This package allows for Error Handling while encoding and decoding JSON.

To install through composer include the package in your composer.json.

"midnite81/json-parser": "^1.0.0"

Run composer install or composer update to download the dependencies or you can run composer require midnite81/json-parser.

Example usage

use Midnite81\JsonParser\JsonParse;

public function returnData() 
{ 
    // your encoded data 
    $myData = '{"message":"Hello World"}'; 
    
    try { 
        JsonParse::decode($myData);
    } catch (JsonException $e) { 
        die('Something went wrong: ' . $e->getMessage());
    }
}