I have a web service that queries a YouTube API and receives an XML response back (this particular YouTube API method only supports XML). I need to convert the XML response into a particularly formatted JSON response, using PHP.
## Deliverables
Example source XML and output JSON format is included in an attachment. The PHP script you write should take the XML input as a string and echo the JSON output. I put together a short document explaining exactly what fields need to be translated from XML to JSON, and how they should be converted. The left-hand side of the -> symbol is the XML field and the right-hand side is the JSON field. Some of the transformations will involve minor string or attribute processing. Any field that I have not listed here is a low priority and not required for successful completion of the function. 2011-01-11T16:13:40.000Z -> "updated": "2011-01-11T16:13:40.000Z" -> "accessControl":{ "syndicate":"allowed", "commentVote":"allowed", "rate":"allowed", "list":"allowed", "comment":"allowed", "embed":"allowed", "videoRespond":"allowed" } GoogleDevelopers -> "uploader":"GoogleDevelopers" -> "player":{ "default":"[login to view URL]\u003dADos_xW4_J0&feature\u003dyoutube_gdata_player" } undefined -> "location":"undefined" Education -> "category":"Education" -> "content":{ "1":"rtsp://[login to view URL]", "5":"[login to view URL]\u003dvideos&app\u003dyoutube_gdata", "6":"rtsp://[login to view URL]" } Jeff Fisher walks through basic history and concepts behind the Google Data protocol. Visit the documentation for more information and list of available APIs:[login to view URL] -> "description":"Jeff Fisher walks through basic history and concepts behind the Google Data protocol. Visit the documentation for more information and list of available APIs:\r\n\r\n[login to view URL]" google, data, gdata, introduction, courses, engineering, gcvprodtuto, plidAB86CD8B942A122B -> "tags":[ "google", "data", "gdata", "introduction", "courses", "engineering", "gcvprodtuto", "plidAB86CD8B942A122B" ] -> "thumbnail":{ "sqDefault":"[login to view URL]", "hqDefault":"[login to view URL]" } Introduction to Google Data -> "title":"Introduction to Google Data" -> "duration":739 2007-12-21T10:13:44.000Z -> "uploaded":"2007-12-21T10:13:44.000Z" ADos_xW4_J0 -> "id": "ADos_xW4_J0" -> "rating":4.53 -> "favoriteCount":104, "viewCount":70762
## Platform
PHP 5.x