I am attempting to get a JSON feed output from attributes of an XML feed. I can get the data out of the XML, however, I am unable to get it to format correctly. The error seems to be with the json_encode not adding the curly braces to the outputted date. This is the code I have so far:
<?php
    $url = 'http://cloud.tfl.gov.uk/TrackerNet/LineStatus';
    if(!$xml = simplexml_load_file($url))
    {
        die("No xml for you");
    }
    $linestatus = array();
    foreach ($xml->LineStatus as $line)
    {
        echo $line->Line['Name'];
        echo $line->Status['Description'];
    }
    header('Content-Type: application/json');
    print_r(json_encode($linestatus));
?>