Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
/ json-helpers Public archive

Exception-based wrappers for json_encode and json_decode

License

Notifications You must be signed in to change notification settings

digiaonline/json-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-helpers

Build Status

Exception-based wrappers for json_encode and json_decode

Requirements

  • PHP >= 7.0

Installation

composer require digiaonline/json-helpers

Usage

Encoding

<?php

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

try {
    $json = \Digia\JsonHelpers\JsonEncoder::encode($data);    
}
catch (\InvalidArgumentException $e) {
    
}

Decoding

<?php

$json = '["foo":"bar"]';

try {
    $data = \Digia\JsonHelpers\JsonDecoder::decode($data);    
}
catch (\InvalidArgumentException $e) {
    
}

License

MIT

About

Exception-based wrappers for json_encode and json_decode

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages