https://github.com/gromnan/jsonx-php
JSONx parser for PHP
https://github.com/gromnan/jsonx-php
jsonx
Last synced: 4 months ago
JSON representation
JSONx parser for PHP
- Host: GitHub
- URL: https://github.com/gromnan/jsonx-php
- Owner: GromNaN
- Created: 2014-09-19T15:13:02.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T14:49:06.000Z (almost 3 years ago)
- Last Synced: 2025-04-16T02:15:38.306Z (about 1 year ago)
- Topics: jsonx
- Language: PHP
- Size: 13.7 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
JSONX for PHP
=============
JSONx is a standard to represent JSON as XML.
You can read the [documentation on IBM website](https://www.ibm.com/docs/fr/datapower-gateway/10.5.x?topic=20-jsonx).
Features
--------
* Convert any `DOMNode` of JSONx into PHP data that can be JSON encoded.
Install
-------
composer require grom/jsonx
Usage
-----
```php
// load jsonx file ...
require_once __DIR__.'/../src/jsonx.php';
// or use composer
require 'vendor/autoload.php';
$xml = <<
false
62.4
2015-08-29 15:07:00
> 640
XML;
$dom = new \DOMDocument();
$dom->loadXML($xml);
$data = JSONx\parse($dom->documentElement);
var_dump(json_encode($data));
/*
string(69) "{"remote":false,"height":62.4,"date":1440860820,"ficoScore":" > 640"}"
*/
```