Browsing articles in "JSON"
Jul 26, 2012
kalpesh

Convert PHP XML to JSON, XML to Array, JSON to Array

Converting PHP XML to JSON, XML to Array, JSON to Array is very difficult task for some people. But, in PHP, believe me it’s very easy. One line of code each! Don’t believe? Just check out the code below and test it yourself!

$xml = simplexml_load_string($xmlstring);
$json = json_encode($xml);
$arr = json_decode($json,true);

Happy Coding!

Welcome to my Blog

Kalpesh MehtaHelping Magento developers in their day-to-day development problems since 2011. Most of the problems and solutions here are my own experiences while working on different projects. Enjoy the blog and don't forget to throw comments and likes/+1's/tweets on posts you like. Thanks for visiting!

Certifications

Honor

Recognition

Magento top 50 contributors

Magento top 50 contributors

Contributions