4

I was thinking, it might be able to use and process XML data if i can run the XML through a func to validate it (against a schema) then convert the XML to json for easy object access? How can i convert XML to JSON easily?

2 Answers 2

11
$json = json_encode(simplexml_load_string($xmlString));
$array = json_decode($json,true);
1
  • This is considerably more simple than the selected answer.
    – Matt
    Commented Dec 17, 2013 at 16:24
-2

http://www.ibm.com/developerworks/xml/library/x-xml2jsonphp/

1
  • 2
    The best answer i have ever seen. No words, reference link, a great explanation and working code ;D Commented Oct 5, 2009 at 19:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.