I am using this simple code to print an array as a JSON structure.
header('Content-Type: application/json');
echo json_encode($this->data, JSON_PRETTY_PRINT);
I'm using Chrome Version 28.0.1500.95 m. For some odd reason the output is wrapped in a pre tag with a tab character (i.e. \t) at the beginning.
JSON seems to be parsing okay but I still get that tab character when no data is sent. How can I fix this ?
<pre style="word-wrap: break-word; white-space: pre-wrap;"> {
    "title": "Node",
    "items": [
        {
            "label": "Do stuff",
            "icon": "..\/ui\/images\/icons\/16x16\/icon.png",
            "action": "dostuff"
        }
    ]
}</pre>
Edit: Here's the code on the jQuery side:
$.ajax({
    url : "/myproject/getmenu/",
    type : 'GET',
    dataType: "json",
    success : function(data) {
        //alert(JSON.stringify(data,undefined,2));
        if (jQuery.isEmptyObject(data)) {
            return;
        }
        title = data.title;
        items = data.items;
        selected.contextPopup({
            title : title,
            items : items
        });
    }
});
 
     
     
    