I am trying to create a properly formatted JSON result using CodeIgniter, but in the result shown below, it looks like there is an extra hyphen or dash character, as shown here:
Here is the code that I am using to generate the query result:
function y($mun) {
$q = $this->db->query("SELECT RollNum , Address, v2_lat, v2_lng
FROM mytable
WHERE Municipality = '" . $mun . "' LIMIT 100");
echo json_encode($q->result());
exit;
}
Can someone explain why there appears to be an extra character appearing?
You might be using some of the Chrome or other browers extensions/addons like JSONView - https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc?hl=en
So here the '-' is just a button to minimize or collapse that particular block.
Its not in the JSON
, but provided by the the addon
.
If you disable
the extension/addon
for a moment and then try to print the JSON
, you'll see no '-' there.