steein / json_data
This library is an object-oriented interface that works with data in JSON format
dev-master / 1.0.1.x-dev
2017-01-22 00:42 UTC
Requires
- php: ^7.0
- justinrainbow/json-schema: 4.1.0
- phpunit/phpunit: 5.7.5
This package is not auto-updated.
Last update: 2025-04-26 23:15:33 UTC
README
This library is an object-oriented interface that works with data in JSON format
Usage
Example 1
use SteeinJSON\JSON; $myJson = " { "steein": { "item":"value" } } "; $object = new JSON($myJson);
Example 2
use SteeinJSON\JSON; $object = new JSON(); $object->text->item = 'value'; $object->text->item->one = 'value2'; //By default, simply output through "echo" echo $object; //At the request is allowed to maintain in a JSON file $file = __DIR__.'/json/item.json'; $object->save($file);
Working with existing objects
If you would like to work with an existing object, rather than parsing a string, pass this object as the third constructor argument:
use SteeinJSON\JSON; $object = new JSON(null, null, $customJSON); ///Validating Against a Schema $object->check($customSchema, [$extraSchemaURI => $extraSchemaData]);