A PHP Library to transform XML into JSON and JSON into XML following the BadgerFish convention.
Forked from jobywalker/Imperium-BadgerFish in order to remove namespace and a minor improvement to XML exporting.
Usage:
$json = '{ "anode": { "@xmlns": "http://anode.ns", "@id": 1, "child": { "@id": 10, "type": "anodes kid", "value": 123.45 } } }';
header("content-type: text/plain");
echo $json;
echo "\n\n";
echo BadgerFish::jsonToXML($json);
If you dont need the <?xml>
tag starting your output, just do:
$xml = BadgerFish::jsonToXML($json, false);
The second argument controls the ouput of <?xml>
tag.