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);
Sign up to request clarification or add additional context in comments.

1 Comment

This is considerably more simple than the selected answer.
-2

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

1 Comment

The best answer i have ever seen. No words, reference link, a great explanation and working code ;D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.