An open API service indexing awesome lists of open source software.

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

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"}"
*/
```