https://github.com/mirkoschubert/jsonparser
A clean and simple Parser to read, write, edit and delete JSON files.
https://github.com/mirkoschubert/jsonparser
Last synced: about 1 month ago
JSON representation
A clean and simple Parser to read, write, edit and delete JSON files.
- Host: GitHub
- URL: https://github.com/mirkoschubert/jsonparser
- Owner: mirkoschubert
- Created: 2015-07-04T21:57:56.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-04T22:00:16.000Z (almost 11 years ago)
- Last Synced: 2025-01-12T13:15:18.334Z (over 1 year ago)
- Language: PHP
- Size: 109 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How to use the JSONParser Class
## Open or Create a JSON File
There is an optional language variable for creating multi-language JSON files.
```php
$json = new JSONParser('filename.json', 'en-en');
```
## Create a new Entry
The 'name' variable must be set as an identificator
```php
$brian = new stdClass();
$brian->name = 'brian';
$brian->city = 'memphis';
$json->appendEntry($brian);
```
## Edit an existing Entry
```php
$brian = selectEntryByName('brian');
unset($brian->city);
$brian->surname = 'walker';
$json->updateEntry($brian);
```
## Delete an Entry
```php
$json->deleteEntry('brian');
```
## Access JSON stream directly
For API porposes there are two variables:
```php
$json->stream
```
Full JSON Stream with language, created and updated dates and status messages.
```php
$json->data
```
Data stream to manipulate the JSON data directly.
Have fun!