2017 © Pedro Peláez
 

library jsonx

JSONx parser for PHP

image

grom/jsonx

JSONx parser for PHP

  • Monday, January 11, 2016
  • by GromNaN
  • Repository
  • 1 Watchers
  • 1 Stars
  • 75 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

JSONX for PHP

JSONx is a standard to represent JSON as XML., (*1)

You can read the documentation on IBM website., (*2)

Features

  • Convert any DOMNode of JSONx into PHP data that can be JSON encoded.

Install

composer require grom/jsonx

Usage

// load jsonx file ...
require_once __DIR__.'/../src/jsonx.php';

// or use composer
require 'vendor/autoload.php';

$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<json:object xsi:schemaLocation="http://www.datapower.com/schemas/json jsonx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:json="http://www.ibm.com/xmlns/prod/2009/jsonx">
    <json:boolean name="remote">false</json:boolean>
    <json:number name="height">62.4</json:number>
    <json:time name="date">2015-08-29 15:07:00</json:time>
    <json:string name="ficoScore"> > 640</json:string>
</json:object>
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"}"
 */

The Versions

11/01 2016

dev-master

9999999-dev

JSONx parser for PHP

  Sources   Download

MIT

The Requires

  • php >= 5.3.6

 

by Jérôme Tamarelle

17/12 2015

v1.0.0

1.0.0.0

JSONx parser for PHP

  Sources   Download

MIT

The Requires

  • php >= 5.3.6

 

by Jérôme Tamarelle