Quantcast
Channel: Is there any way to convert json to xml in PHP? - Stack Overflow
Browsing latest articles
Browse All 7 View Live

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 Article



Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Is 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
Browsing latest articles
Browse All 7 View Live


Latest Images