Answer by Gordon for Is there any way to convert json to xml in PHP?
Another option would be to use a JSON streaming parser. Using a streamer parser would come in handy if you want to bypass the intermediate object graph created by PHP when using json_decode. For...
View ArticleAnswer by 131 for Is there any way to convert json to xml in PHP?
A native approch might befunction json_to_xml($obj){ $str = ""; if(is_null($obj)) return "<null/>"; elseif(is_array($obj)) { //a list is a hash with 'simple' incremental keys $is_list =...
View ArticleAnswer by spiky for Is there any way to convert json to xml in PHP?
I combined the two earlier suggestions into:/** * Convert JSON to XML * @param string - json * @return string - XML */function json_to_xml($json){ include_once("XML/Serializer.php"); $options = array...
View ArticleAnswer by Marcelo Cantos for Is there any way to convert json to xml in PHP?
Crack open the JSON with json_decode, and traverse it to generate whatever XML you want.In case you're wondering, there is no canonical mapping between JSON and XML, so you have to write the...
View ArticleAnswer by Samir Talwar for Is there any way to convert json to xml in PHP?
If you're willing to use the XML Serializer from PEAR, you can convert the JSON to a PHP object and then the PHP object to XML in two easy steps:include("XML/Serializer.php");function...
View ArticleAnswer by Tomalak for Is there any way to convert json to xml in PHP?
It depends on how exactly you want you XML to look like. I would try a combination of json_decode() and the PEAR::XML_Serializer (more info and examples on sitepoint.com).require_once...
View ArticleIs there any way to convert json to xml in PHP?
Is there any way to convert json to xml in PHP? I know that xml to json is very much possible.
View Article