Tab and pre wrapped around JSON output in Chrome
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 (/t) at the beginning.
The tab seems to cause jQuery.isEmptyObject to not work as intended. How
could this be fixed ?
How
<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>
No comments:
Post a Comment