DanielAttard
DanielAttard

Reputation: 3605

Hyphen prepended to every row in my json string when printed in my browsser

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:

JSON with extra character

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?

Upvotes: 0

Views: 81

Answers (1)

Parag Tyagi
Parag Tyagi

Reputation: 8960

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.

Upvotes: 1

Related Questions