ortnit/json

wrapper for json functions

Maintainers

Details

github.com/ortnit/json

Source

Issues

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/ortnit/json

v1.0.0 2022-01-30 05:49 UTC

This package is auto-updated.

Last update: 2025-09-29 02:51:05 UTC


README

workflow badge

Readme

Helper for php functions json_enconde() and json_decode(). JSON_THROW_ON_ERROR will always be applied, so every error will be thrown as exception. Other flags can also be set, the configuration is static.

Per default Json::decode() will create assoc arrays, not objects.

Json::decode(string $json, bool $assoc = true) will decode json and return the decoded structure

Json::encode(mixed $value) will encode the value and return the json string

Json::setOptions(...$options) allow you to set the JSON flags from the php documentation, https://www.php.net/manual/en/json.constants.php. Function will overwrite all flags.

Json::getOptions() will return the current options set