Preserve types when doing json_encode - php

json_encode does not preserver doubles without numbers after comma
echo json_encode(['a' => 4.0]);
{"a":4}
How to force json_encode to do this?
echo json_encode(['a' => 4.0]);
{"a":4.0}

you can try like this
echo json_encode($data, JSON_PRESERVE_ZERO_FRACTION);

add JSON_PRESERVE_ZERO_FRACTION optional parameter when you are encoding your data as
$json = json_encode($data, JSON_PRESERVE_ZERO_FRACTION);

Related

unserialize function in php ads extra slashes to the result string

this is a serialized form:
[featureimg520_624] => a:2:{s:9:"image_url";s:47:"2019/05/2019-05-27-06-07-02keerthy-suresh2.jpeg"
after unserialize I get
"image_url":"2019\/05\/2019-05-27-06-07-02keerthy-suresh2.jpeg"
with extra backslashes
I tried stripcslashes, stripslashes, str_replace
but nothing worked.
It's json_encode which is adding those backslashes. You can avoid them by using the JSON_UNESCAPED_SLASHES option to that function:
$string = 'a:1:{s:9:"image_url";s:47:"2019/05/2019-05-27-06-07-02keerthy-suresh2.jpeg";}';
$array = unserialize($string);
echo json_encode($array, JSON_UNESCAPED_SLASHES);
Output:
{"image_url":"2019/05/2019-05-27-06-07-02keerthy-suresh2.jpeg"}

Decode string php

I am trying to decode a string in PHP but I have not idea what the encoding is.
My string is
\x5B\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20d\x27Asni\x5Cu00e8res\x20sur\x20Seine\x20Belfort\x22,\x22id\x22\x3A\x225337\x22,\x22lati\x22\x3A\x2248.907864\x22,\x22long\x22\x3A\x222.268167\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20d\x27Asni\x5Cu00e8res\x20sur\x20Seine\x20Les\x20Hauts\x20d\x27Asni\x5Cu00e8res\x22,\x22id\x22\x3A\x225338\x22,\x22lati\x22\x3A\x2248.925983\x22,\x22long\x22\x3A\x222.274256\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Bagneux\x20Port\x20Galand\x22,\x22id\x22\x3A\x225339\x22,\x22lati\x22\x3A\x2248.788372\x22,\x22long\x22\x3A\x222.317539\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Bois\x20Colombes\x20Les\x20Bruy\x5Cu00e8res\x22,\x22id\x22\x3A\x225340\x22,\x22lati\x22\x3A\x2248.908581\x22,\x22long\x22\x3A\x222.262088\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Colombes\x20Foss\x5Cu00e9\x20Jean\x22,\x22id\x22\x3A\x225342\x22,\x22lati\x22\x3A\x2248.93106\x22,\x22long\x22\x3A\x222.267059\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Colombes\x20Wiener\x22,\x22id\x22\x3A\x225343\x22,\x22lati\x22\x3A\x2248.915141\x22,\x22long\x22\x3A\x222.246733\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Courbevoie\x20\x2D\x20Quartier\x20de\x20B\x5Cu00e9con\x22,\x22id\x22\x3A\x225344\x22,\x22lati\x22\x3A\x2248.901328\x22,\x22long\x22\x3A\x222.265769\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Courbevoie\x20\x2D\x20Quartier\x20Faubourg\x20de\x20l\x27Arche\x22,\x22id\x22\x3A\x225345\x22,\x22lati\x22\x3A\x2248.897737\x22,\x22long\x22\x3A\x222.238265\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20Meudon\x20la\x20For\x5Cu00eat\x20Place\x20Centrale\x22,\x22id\x22\x3A\x225346\x22,\x22lati\x22\x3A\x2248.787749\x22,\x22long\x22\x3A\x222.227974\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2010\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224463\x22,\x22lati\x22\x3A\x2248.871982\x22,\x22long\x22\x3A\x222.357889\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2012\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224464\x22,\x22lati\x22\x3A\x2248.840246\x22,\x22long\x22\x3A\x222.388204\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2014\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224465\x22,\x22lati\x22\x3A\x2248.832864\x22,\x22long\x22\x3A\x222.326462\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2015\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224475\x22,\x22lati\x22\x3A\x2248.841647\x22,\x22long\x22\x3A\x222.299668\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2016\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224466\x22,\x22lati\x22\x3A\x2248.863973\x22,\x22long\x22\x3A\x222.277212\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2017\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224467\x22,\x22lati\x22\x3A\x2248.883034\x22,\x22long\x22\x3A\x222.32408\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2018\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224468\x22,\x22lati\x22\x3A\x2248.892666\x22,\x22long\x22\x3A\x222.337346\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2019\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224461\x22,\x22lati\x22\x3A\x2248.876334\x22,\x22long\x22\x3A\x222.39318\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2020\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224469\x22,\x22lati\x22\x3A\x2248.864976\x22,\x22long\x22\x3A\x222.39871\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x205\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224471\x22,\x22lati\x22\x3A\x2248.846319\x22,\x22long\x22\x3A\x222.344516\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x207\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224472\x22,\x22lati\x22\x3A\x2248.856888\x22,\x22long\x22\x3A\x222.319964\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x208\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224473\x22,\x22lati\x22\x3A\x2248.877862\x22,\x22long\x22\x3A\x222.317804\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x209\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224474\x22,\x22lati\x22\x3A\x2248.872497\x22,\x22long\x22\x3A\x222.340366\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20d\x27ALFORTVILLE\x22,\x22id\x22\x3A\x225392\x22,\x22lati\x22\x3A\x2248.80529\x22,\x22long\x22\x3A\x222.420021\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20d\x27ARCUEIL\x22,\x22id\x22\x3A\x225032\x22,\x22lati\x22\x3A\x2248.805973\x22,\x22long\x22\x3A\x222.336826\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20ASNIERES\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224799\x22,\x22lati\x22\x3A\x2248.910354\x22,\x22long\x22\x3A\x222.289417\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20AUBERVILLIERS\x22,\x22id\x22\x3A\x224825\x22,\x22lati\x22\x3A\x2248.914652\x22,\x22long\x22\x3A\x222.381673\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BAGNEUX\x22,\x22id\x22\x3A\x224800\x22,\x22lati\x22\x3A\x2248.798652\x22,\x22long\x22\x3A\x222.304296\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BAGNOLET\x22,\x22id\x22\x3A\x224827\x22,\x22lati\x22\x3A\x2248.868921\x22,\x22long\x22\x3A\x222.417979\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BOIS\x20COLOMBES\x22,\x22id\x22\x3A\x224824\x22,\x22lati\x22\x3A\x2248.914476\x22,\x22long\x22\x3A\x222.267797\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BOULOGNE\x20BILLANCOURT\x22,\x22id\x22\x3A\x224801\x22,\x22lati\x22\x3A\x2248.835388\x22,\x22long\x22\x3A\x222.24031\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CACHAN\x22,\x22id\x22\x3A\x224859\x22,\x22lati\x22\x3A\x2248.794443\x22,\x22long\x22\x3A\x222.331244\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHARENTON\x20LE\x20PONT\x22,\x22id\x22\x3A\x225395\x22,\x22lati\x22\x3A\x2248.819851\x22,\x22long\x22\x3A\x222.415667\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATENAY\x20MALABRY\x22,\x22id\x22\x3A\x224802\x22,\x22lati\x22\x3A\x2248.767087\x22,\x22long\x22\x3A\x222.277421\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATILLON\x22,\x22id\x22\x3A\x225382\x22,\x22lati\x22\x3A\x2248.799868\x22,\x22long\x22\x3A\x222.289823\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATOU\x22,\x22id\x22\x3A\x224531\x22,\x22lati\x22\x3A\x2248.890074\x22,\x22long\x22\x3A\x222.157537\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHOISY\x20LE\x20ROI\x22,\x22id\x22\x3A\x224861\x22,\x22lati\x22\x3A\x2248.762448\x22,\x22long\x22\x3A\x222.406938\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CLAMART\x22,\x22id\x22\x3A\x224803\x22,\x22lati\x22\x3A\x2248.800313\x22,\x22long\x22\x3A\x222.263162\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CLICHY\x22,\x22id\x22\x3A\x224804\x22,\x22lati\x22\x3A\x2248.902389\x22,\x22long\x22\x3A\x222.304312\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20COLOMBES\x22,\x22id\x22\x3A\x224805\x22,\x22lati\x22\x3A\x2248.92276\x22,\x22long\x22\x3A\x222.254343\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20COURBEVOIE\x22,\x22id\x22\x3A\x224806\x22,\x22lati\x22\x3A\x2248.895463\x22,\x22long\x22\x3A\x222.2565\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20DRANCY\x22,\x22id\x22\x3A\x224831\x22,\x22lati\x22\x3A\x2248.925691\x22,\x22long\x22\x3A\x222.389513\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20FRESNES\x22,\x22id\x22\x3A\x225398\x22,\x22lati\x22\x3A\x2248.75534\x22,\x22long\x22\x3A\x222.322471\x22\x7D,\x7B\x22name\x22\x3A\x22mairie\x20de\x20Garches\x22,\x22id\x22\x3A\x225287\x22,\x22lati\x22\x3A\x2248.843147\x22,\x22long\x22\x3A\x222.186586\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20GENNEVILLIERS\x22,\x22id\x22\x3A\x224807\x22,\x22lati\x22\x3A\x2248.925846\x22,\x22long\x22\x3A\x222.294367\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20HOUILLES\x22,\x22id\x22\x3A\x224535\x22,\x22lati\x22\x3A\x2248.923084\x22,\x22long\x22\x3A\x222.186666\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20ISSY\x20LES\x20MOULINEAUX\x22,\x22id\x22\x3A\x224808\x22,\x22lati\x22\x3A\x2248.82423\x22,\x22long\x22\x3A\x222.273643\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20IVRY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224864\x22,\x22lati\x22\x3A\x2248.807809\x22,\x22long\x22\x3A\x222.374647\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20L\x27HAY\x20LES\x20ROSES\x22,\x22id\x22\x3A\x224868\x22,\x22lati\x22\x3A\x2248.778867\x22,\x22long\x22\x3A\x222.337234\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LA\x20COURNEUVE\x22,\x22id\x22\x3A\x224835\x22,\x22lati\x22\x3A\x2248.926341\x22,\x22long\x22\x3A\x222.391157\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LA\x20GARENNE\x20COLOMBES\x22,\x22id\x22\x3A\x224809\x22,\x22lati\x22\x3A\x2248.906762\x22,\x22long\x22\x3A\x222.246125\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20BOURGET\x22,\x22id\x22\x3A\x224837\x22,\x22lati\x22\x3A\x2248.934871\x22,\x22long\x22\x3A\x222.425765\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20PLESSIS\x20ROBINSON\x22,\x22id\x22\x3A\x224823\x22,\x22lati\x22\x3A\x2248.78248\x22,\x22long\x22\x3A\x222.262036\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20PRE\x20SAINT\x20GERVAIS\x22,\x22id\x22\x3A\x224838\x22,\x22lati\x22\x3A\x2248.883069\x22,\x22long\x22\x3A\x222.403281\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LES\x20LILAS\x22,\x22id\x22\x3A\x224840\x22,\x22lati\x22\x3A\x2248.880519\x22,\x22long\x22\x3A\x222.41849\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LEVALLOIS\x22,\x22id\x22\x3A\x224810\x22,\x22lati\x22\x3A\x2248.893086\x22,\x22long\x22\x3A\x222.288514\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MALAKOFF\x22,\x22id\x22\x3A\x224811\x22,\x22lati\x22\x3A\x2248.820888\x22,\x22long\x22\x3A\x222.301668\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MEUDON\x22,\x22id\x22\x3A\x224812\x22,\x22lati\x22\x3A\x2248.812558\x22,\x22long\x22\x3A\x222.238593\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MONTROUGE\x22,\x22id\x22\x3A\x224813\x22,\x22lati\x22\x3A\x2248.818705\x22,\x22long\x22\x3A\x222.319896\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20NANTERRE\x22,\x22id\x22\x3A\x224814\x22,\x22lati\x22\x3A\x2248.892044\x22,\x22long\x22\x3A\x222.205266\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20NEUILLY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224815\x22,\x22lati\x22\x3A\x2248.885111\x22,\x22long\x22\x3A\x222.266186\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20PANTIN\x22,\x22id\x22\x3A\x224845\x22,\x22lati\x22\x3A\x2248.896479\x22,\x22long\x22\x3A\x222.401907\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20PUTEAUX\x22,\x22id\x22\x3A\x224816\x22,\x22lati\x22\x3A\x2248.8843\x22,\x22long\x22\x3A\x222.236835\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20RUEIL\x20MALMAISON\x22,\x22id\x22\x3A\x224817\x22,\x22lati\x22\x3A\x2248.877939\x22,\x22long\x22\x3A\x222.180679\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20CLOUD\x22,\x22id\x22\x3A\x224818\x22,\x22lati\x22\x3A\x2248.843706\x22,\x22long\x22\x3A\x222.219356\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x2DDENIS\x22,\x22id\x22\x3A\x224851\x22,\x22lati\x22\x3A\x2248.936005\x22,\x22long\x22\x3A\x222.358906\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20MANDE\x22,\x22id\x22\x3A\x225407\x22,\x22lati\x22\x3A\x2248.843501\x22,\x22long\x22\x3A\x222.419041\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20MAURICE\x22,\x22id\x22\x3A\x224873\x22,\x22lati\x22\x3A\x2248.818091\x22,\x22long\x22\x3A\x222.423183\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20OUEN\x22,\x22id\x22\x3A\x224850\x22,\x22lati\x22\x3A\x2248.912188\x22,\x22long\x22\x3A\x222.333285\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SCEAUX\x22,\x22id\x22\x3A\x224819\x22,\x22lati\x22\x3A\x2248.778775\x22,\x22long\x22\x3A\x222.288772\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SEVRES\x22,\x22id\x22\x3A\x224820\x22,\x22lati\x22\x3A\x2248.824434\x22,\x22long\x22\x3A\x222.21308\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SURESNES\x22,\x22id\x22\x3A\x224821\x22,\x22lati\x22\x3A\x2248.87113\x22,\x22long\x22\x3A\x222.224667\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20THIAIS\x22,\x22id\x22\x3A\x224875\x22,\x22lati\x22\x3A\x2248.765315\x22,\x22long\x22\x3A\x222.388829\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VANVES\x22,\x22id\x22\x3A\x224822\x22,\x22lati\x22\x3A\x2248.821396\x22,\x22long\x22\x3A\x222.289619\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VELIZY\x20VILLACOUBLAY\x22,\x22id\x22\x3A\x224558\x22,\x22lati\x22\x3A\x2248.782531\x22,\x22long\x22\x3A\x222.191265\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VILLEJUIF\x22,\x22id\x22\x3A\x224876\x22,\x22lati\x22\x3A\x2248.794931\x22,\x22long\x22\x3A\x222.366248\x22\x7D,\x7B\x22name\x22\x3A\x22mairie\x20de\x20Villeneuve\x2Dla\x2DGarenne\x22,\x22id\x22\x3A\x223990\x22,\x22lati\x22\x3A\x2248.935596\x22,\x22long\x22\x3A\x222.332934\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VIROFLAY\x22,\x22id\x22\x3A\x224559\x22,\x22lati\x22\x3A\x2248.799422\x22,\x22long\x22\x3A\x222.172793\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VITRY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224878\x22,\x22lati\x22\x3A\x2248.788757\x22,\x22long\x22\x3A\x222.38929\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20LE\x20KREMLIN\x20BICETRE\x22,\x22id\x22\x3A\x225400\x22,\x22lati\x22\x3A\x2248.812652\x22,\x22long\x22\x3A\x222.356646\x22\x7D,\x7B\x22name\x22\x3A\x22Pr\x5Cu00e9fecture\x20de\x20Police\x20\x20\x2D\x20Site\x20de\x20Gesvres\x204\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224470\x22,\x22lati\x22\x3A\x2248.856894\x22,\x22long\x22\x3A\x222.348783\x22\x7D\x5D
I tried json_decode($myString) but it doesn't works
it works in javascript JSON.parse(...)
This is a JSON alright but in hex so converting from hex to string and should output to browser as JSON
<?php
header('Content-type: application/json');
function decode_code($code){
return preg_replace_callback(
"#\\\(x)?([0-9a-f]{2,3})#",
function($m){
return chr($m[1]?hexdec($m[2]):octdec($m[2]));
},
$code
);
}
echo (decode_code("\x5B\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20d\x27Asni\x5Cu00e8res\x20sur\x20Seine\x20Belfort\x22,\x22id\x22\x3A\x225337\x22,\x22lati\x22\x3A\x2248.907864\x22,\x22long\x22\x3A\x222.268167\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20d\x27Asni\x5Cu00e8res\x20sur\x20Seine\x20Les\x20Hauts\x20d\x27Asni\x5Cu00e8res\x22,\x22id\x22\x3A\x225338\x22,\x22lati\x22\x3A\x2248.925983\x22,\x22long\x22\x3A\x222.274256\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Bagneux\x20Port\x20Galand\x22,\x22id\x22\x3A\x225339\x22,\x22lati\x22\x3A\x2248.788372\x22,\x22long\x22\x3A\x222.317539\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Bois\x20Colombes\x20Les\x20Bruy\x5Cu00e8res\x22,\x22id\x22\x3A\x225340\x22,\x22lati\x22\x3A\x2248.908581\x22,\x22long\x22\x3A\x222.262088\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Colombes\x20Foss\x5Cu00e9\x20Jean\x22,\x22id\x22\x3A\x225342\x22,\x22lati\x22\x3A\x2248.93106\x22,\x22long\x22\x3A\x222.267059\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Colombes\x20Wiener\x22,\x22id\x22\x3A\x225343\x22,\x22lati\x22\x3A\x2248.915141\x22,\x22long\x22\x3A\x222.246733\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Courbevoie\x20\x2D\x20Quartier\x20de\x20B\x5Cu00e9con\x22,\x22id\x22\x3A\x225344\x22,\x22lati\x22\x3A\x2248.901328\x22,\x22long\x22\x3A\x222.265769\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Courbevoie\x20\x2D\x20Quartier\x20Faubourg\x20de\x20l\x27Arche\x22,\x22id\x22\x3A\x225345\x22,\x22lati\x22\x3A\x2248.897737\x22,\x22long\x22\x3A\x222.238265\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20Meudon\x20la\x20For\x5Cu00eat\x20Place\x20Centrale\x22,\x22id\x22\x3A\x225346\x22,\x22lati\x22\x3A\x2248.787749\x22,\x22long\x22\x3A\x222.227974\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2010\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224463\x22,\x22lati\x22\x3A\x2248.871982\x22,\x22long\x22\x3A\x222.357889\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2012\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224464\x22,\x22lati\x22\x3A\x2248.840246\x22,\x22long\x22\x3A\x222.388204\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2014\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224465\x22,\x22lati\x22\x3A\x2248.832864\x22,\x22long\x22\x3A\x222.326462\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2015\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224475\x22,\x22lati\x22\x3A\x2248.841647\x22,\x22long\x22\x3A\x222.299668\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2016\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224466\x22,\x22lati\x22\x3A\x2248.863973\x22,\x22long\x22\x3A\x222.277212\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2017\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224467\x22,\x22lati\x22\x3A\x2248.883034\x22,\x22long\x22\x3A\x222.32408\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2018\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224468\x22,\x22lati\x22\x3A\x2248.892666\x22,\x22long\x22\x3A\x222.337346\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2019\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224461\x22,\x22lati\x22\x3A\x2248.876334\x22,\x22long\x22\x3A\x222.39318\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2020\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224469\x22,\x22lati\x22\x3A\x2248.864976\x22,\x22long\x22\x3A\x222.39871\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x205\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224471\x22,\x22lati\x22\x3A\x2248.846319\x22,\x22long\x22\x3A\x222.344516\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x207\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224472\x22,\x22lati\x22\x3A\x2248.856888\x22,\x22long\x22\x3A\x222.319964\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x208\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224473\x22,\x22lati\x22\x3A\x2248.877862\x22,\x22long\x22\x3A\x222.317804\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x209\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224474\x22,\x22lati\x22\x3A\x2248.872497\x22,\x22long\x22\x3A\x222.340366\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20d\x27ALFORTVILLE\x22,\x22id\x22\x3A\x225392\x22,\x22lati\x22\x3A\x2248.80529\x22,\x22long\x22\x3A\x222.420021\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20d\x27ARCUEIL\x22,\x22id\x22\x3A\x225032\x22,\x22lati\x22\x3A\x2248.805973\x22,\x22long\x22\x3A\x222.336826\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20ASNIERES\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224799\x22,\x22lati\x22\x3A\x2248.910354\x22,\x22long\x22\x3A\x222.289417\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20AUBERVILLIERS\x22,\x22id\x22\x3A\x224825\x22,\x22lati\x22\x3A\x2248.914652\x22,\x22long\x22\x3A\x222.381673\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BAGNEUX\x22,\x22id\x22\x3A\x224800\x22,\x22lati\x22\x3A\x2248.798652\x22,\x22long\x22\x3A\x222.304296\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BAGNOLET\x22,\x22id\x22\x3A\x224827\x22,\x22lati\x22\x3A\x2248.868921\x22,\x22long\x22\x3A\x222.417979\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BOIS\x20COLOMBES\x22,\x22id\x22\x3A\x224824\x22,\x22lati\x22\x3A\x2248.914476\x22,\x22long\x22\x3A\x222.267797\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BOULOGNE\x20BILLANCOURT\x22,\x22id\x22\x3A\x224801\x22,\x22lati\x22\x3A\x2248.835388\x22,\x22long\x22\x3A\x222.24031\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CACHAN\x22,\x22id\x22\x3A\x224859\x22,\x22lati\x22\x3A\x2248.794443\x22,\x22long\x22\x3A\x222.331244\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHARENTON\x20LE\x20PONT\x22,\x22id\x22\x3A\x225395\x22,\x22lati\x22\x3A\x2248.819851\x22,\x22long\x22\x3A\x222.415667\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATENAY\x20MALABRY\x22,\x22id\x22\x3A\x224802\x22,\x22lati\x22\x3A\x2248.767087\x22,\x22long\x22\x3A\x222.277421\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATILLON\x22,\x22id\x22\x3A\x225382\x22,\x22lati\x22\x3A\x2248.799868\x22,\x22long\x22\x3A\x222.289823\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATOU\x22,\x22id\x22\x3A\x224531\x22,\x22lati\x22\x3A\x2248.890074\x22,\x22long\x22\x3A\x222.157537\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHOISY\x20LE\x20ROI\x22,\x22id\x22\x3A\x224861\x22,\x22lati\x22\x3A\x2248.762448\x22,\x22long\x22\x3A\x222.406938\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CLAMART\x22,\x22id\x22\x3A\x224803\x22,\x22lati\x22\x3A\x2248.800313\x22,\x22long\x22\x3A\x222.263162\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CLICHY\x22,\x22id\x22\x3A\x224804\x22,\x22lati\x22\x3A\x2248.902389\x22,\x22long\x22\x3A\x222.304312\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20COLOMBES\x22,\x22id\x22\x3A\x224805\x22,\x22lati\x22\x3A\x2248.92276\x22,\x22long\x22\x3A\x222.254343\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20COURBEVOIE\x22,\x22id\x22\x3A\x224806\x22,\x22lati\x22\x3A\x2248.895463\x22,\x22long\x22\x3A\x222.2565\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20DRANCY\x22,\x22id\x22\x3A\x224831\x22,\x22lati\x22\x3A\x2248.925691\x22,\x22long\x22\x3A\x222.389513\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20FRESNES\x22,\x22id\x22\x3A\x225398\x22,\x22lati\x22\x3A\x2248.75534\x22,\x22long\x22\x3A\x222.322471\x22\x7D,\x7B\x22name\x22\x3A\x22mairie\x20de\x20Garches\x22,\x22id\x22\x3A\x225287\x22,\x22lati\x22\x3A\x2248.843147\x22,\x22long\x22\x3A\x222.186586\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20GENNEVILLIERS\x22,\x22id\x22\x3A\x224807\x22,\x22lati\x22\x3A\x2248.925846\x22,\x22long\x22\x3A\x222.294367\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20HOUILLES\x22,\x22id\x22\x3A\x224535\x22,\x22lati\x22\x3A\x2248.923084\x22,\x22long\x22\x3A\x222.186666\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20ISSY\x20LES\x20MOULINEAUX\x22,\x22id\x22\x3A\x224808\x22,\x22lati\x22\x3A\x2248.82423\x22,\x22long\x22\x3A\x222.273643\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20IVRY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224864\x22,\x22lati\x22\x3A\x2248.807809\x22,\x22long\x22\x3A\x222.374647\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20L\x27HAY\x20LES\x20ROSES\x22,\x22id\x22\x3A\x224868\x22,\x22lati\x22\x3A\x2248.778867\x22,\x22long\x22\x3A\x222.337234\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LA\x20COURNEUVE\x22,\x22id\x22\x3A\x224835\x22,\x22lati\x22\x3A\x2248.926341\x22,\x22long\x22\x3A\x222.391157\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LA\x20GARENNE\x20COLOMBES\x22,\x22id\x22\x3A\x224809\x22,\x22lati\x22\x3A\x2248.906762\x22,\x22long\x22\x3A\x222.246125\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20BOURGET\x22,\x22id\x22\x3A\x224837\x22,\x22lati\x22\x3A\x2248.934871\x22,\x22long\x22\x3A\x222.425765\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20PLESSIS\x20ROBINSON\x22,\x22id\x22\x3A\x224823\x22,\x22lati\x22\x3A\x2248.78248\x22,\x22long\x22\x3A\x222.262036\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20PRE\x20SAINT\x20GERVAIS\x22,\x22id\x22\x3A\x224838\x22,\x22lati\x22\x3A\x2248.883069\x22,\x22long\x22\x3A\x222.403281\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LES\x20LILAS\x22,\x22id\x22\x3A\x224840\x22,\x22lati\x22\x3A\x2248.880519\x22,\x22long\x22\x3A\x222.41849\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LEVALLOIS\x22,\x22id\x22\x3A\x224810\x22,\x22lati\x22\x3A\x2248.893086\x22,\x22long\x22\x3A\x222.288514\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MALAKOFF\x22,\x22id\x22\x3A\x224811\x22,\x22lati\x22\x3A\x2248.820888\x22,\x22long\x22\x3A\x222.301668\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MEUDON\x22,\x22id\x22\x3A\x224812\x22,\x22lati\x22\x3A\x2248.812558\x22,\x22long\x22\x3A\x222.238593\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MONTROUGE\x22,\x22id\x22\x3A\x224813\x22,\x22lati\x22\x3A\x2248.818705\x22,\x22long\x22\x3A\x222.319896\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20NANTERRE\x22,\x22id\x22\x3A\x224814\x22,\x22lati\x22\x3A\x2248.892044\x22,\x22long\x22\x3A\x222.205266\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20NEUILLY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224815\x22,\x22lati\x22\x3A\x2248.885111\x22,\x22long\x22\x3A\x222.266186\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20PANTIN\x22,\x22id\x22\x3A\x224845\x22,\x22lati\x22\x3A\x2248.896479\x22,\x22long\x22\x3A\x222.401907\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20PUTEAUX\x22,\x22id\x22\x3A\x224816\x22,\x22lati\x22\x3A\x2248.8843\x22,\x22long\x22\x3A\x222.236835\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20RUEIL\x20MALMAISON\x22,\x22id\x22\x3A\x224817\x22,\x22lati\x22\x3A\x2248.877939\x22,\x22long\x22\x3A\x222.180679\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20CLOUD\x22,\x22id\x22\x3A\x224818\x22,\x22lati\x22\x3A\x2248.843706\x22,\x22long\x22\x3A\x222.219356\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x2DDENIS\x22,\x22id\x22\x3A\x224851\x22,\x22lati\x22\x3A\x2248.936005\x22,\x22long\x22\x3A\x222.358906\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20MANDE\x22,\x22id\x22\x3A\x225407\x22,\x22lati\x22\x3A\x2248.843501\x22,\x22long\x22\x3A\x222.419041\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20MAURICE\x22,\x22id\x22\x3A\x224873\x22,\x22lati\x22\x3A\x2248.818091\x22,\x22long\x22\x3A\x222.423183\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20OUEN\x22,\x22id\x22\x3A\x224850\x22,\x22lati\x22\x3A\x2248.912188\x22,\x22long\x22\x3A\x222.333285\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SCEAUX\x22,\x22id\x22\x3A\x224819\x22,\x22lati\x22\x3A\x2248.778775\x22,\x22long\x22\x3A\x222.288772\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SEVRES\x22,\x22id\x22\x3A\x224820\x22,\x22lati\x22\x3A\x2248.824434\x22,\x22long\x22\x3A\x222.21308\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SURESNES\x22,\x22id\x22\x3A\x224821\x22,\x22lati\x22\x3A\x2248.87113\x22,\x22long\x22\x3A\x222.224667\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20THIAIS\x22,\x22id\x22\x3A\x224875\x22,\x22lati\x22\x3A\x2248.765315\x22,\x22long\x22\x3A\x222.388829\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VANVES\x22,\x22id\x22\x3A\x224822\x22,\x22lati\x22\x3A\x2248.821396\x22,\x22long\x22\x3A\x222.289619\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VELIZY\x20VILLACOUBLAY\x22,\x22id\x22\x3A\x224558\x22,\x22lati\x22\x3A\x2248.782531\x22,\x22long\x22\x3A\x222.191265\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VILLEJUIF\x22,\x22id\x22\x3A\x224876\x22,\x22lati\x22\x3A\x2248.794931\x22,\x22long\x22\x3A\x222.366248\x22\x7D,\x7B\x22name\x22\x3A\x22mairie\x20de\x20Villeneuve\x2Dla\x2DGarenne\x22,\x22id\x22\x3A\x223990\x22,\x22lati\x22\x3A\x2248.935596\x22,\x22long\x22\x3A\x222.332934\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VIROFLAY\x22,\x22id\x22\x3A\x224559\x22,\x22lati\x22\x3A\x2248.799422\x22,\x22long\x22\x3A\x222.172793\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VITRY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224878\x22,\x22lati\x22\x3A\x2248.788757\x22,\x22long\x22\x3A\x222.38929\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20LE\x20KREMLIN\x20BICETRE\x22,\x22id\x22\x3A\x225400\x22,\x22lati\x22\x3A\x2248.812652\x22,\x22long\x22\x3A\x222.356646\x22\x7D,\x7B\x22name\x22\x3A\x22Pr\x5Cu00e9fecture\x20de\x20Police\x20\x20\x2D\x20Site\x20de\x20Gesvres\x204\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224470\x22,\x22lati\x22\x3A\x2248.856894\x22,\x22long\x22\x3A\x222.348783\x22\x7D\x5D"));
?>
Your json_encode is encoding unicode characters and they are being escaped. You can change this behaviour by passing the flag JSON_UNESCAPED_UNICODE as second parameter.
echo json_encode($array, JSON_UNESCAPED_UNICODE);
Make sure you're using double quotes:
<?php
$string = "\x5B\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20d\x27Asni\x5Cu00e8res\x20sur\x20Seine\x20Belfort\x22,\x22id\x22\x3A\x225337\x22,\x22lati\x22\x3A\x2248.907864\x22,\x22long\x22\x3A\x222.268167\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20d\x27Asni\x5Cu00e8res\x20sur\x20Seine\x20Les\x20Hauts\x20d\x27Asni\x5Cu00e8res\x22,\x22id\x22\x3A\x225338\x22,\x22lati\x22\x3A\x2248.925983\x22,\x22long\x22\x3A\x222.274256\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Bagneux\x20Port\x20Galand\x22,\x22id\x22\x3A\x225339\x22,\x22lati\x22\x3A\x2248.788372\x22,\x22long\x22\x3A\x222.317539\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Bois\x20Colombes\x20Les\x20Bruy\x5Cu00e8res\x22,\x22id\x22\x3A\x225340\x22,\x22lati\x22\x3A\x2248.908581\x22,\x22long\x22\x3A\x222.262088\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Colombes\x20Foss\x5Cu00e9\x20Jean\x22,\x22id\x22\x3A\x225342\x22,\x22lati\x22\x3A\x2248.93106\x22,\x22long\x22\x3A\x222.267059\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Colombes\x20Wiener\x22,\x22id\x22\x3A\x225343\x22,\x22lati\x22\x3A\x2248.915141\x22,\x22long\x22\x3A\x222.246733\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Courbevoie\x20\x2D\x20Quartier\x20de\x20B\x5Cu00e9con\x22,\x22id\x22\x3A\x225344\x22,\x22lati\x22\x3A\x2248.901328\x22,\x22long\x22\x3A\x222.265769\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20de\x20Courbevoie\x20\x2D\x20Quartier\x20Faubourg\x20de\x20l\x27Arche\x22,\x22id\x22\x3A\x225345\x22,\x22lati\x22\x3A\x2248.897737\x22,\x22long\x22\x3A\x222.238265\x22\x7D,\x7B\x22name\x22\x3A\x22Annexe\x20Mairie\x20Meudon\x20la\x20For\x5Cu00eat\x20Place\x20Centrale\x22,\x22id\x22\x3A\x225346\x22,\x22lati\x22\x3A\x2248.787749\x22,\x22long\x22\x3A\x222.227974\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2010\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224463\x22,\x22lati\x22\x3A\x2248.871982\x22,\x22long\x22\x3A\x222.357889\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2012\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224464\x22,\x22lati\x22\x3A\x2248.840246\x22,\x22long\x22\x3A\x222.388204\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2014\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224465\x22,\x22lati\x22\x3A\x2248.832864\x22,\x22long\x22\x3A\x222.326462\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2015\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224475\x22,\x22lati\x22\x3A\x2248.841647\x22,\x22long\x22\x3A\x222.299668\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2016\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224466\x22,\x22lati\x22\x3A\x2248.863973\x22,\x22long\x22\x3A\x222.277212\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2017\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224467\x22,\x22lati\x22\x3A\x2248.883034\x22,\x22long\x22\x3A\x222.32408\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2018\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224468\x22,\x22lati\x22\x3A\x2248.892666\x22,\x22long\x22\x3A\x222.337346\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2019\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224461\x22,\x22lati\x22\x3A\x2248.876334\x22,\x22long\x22\x3A\x222.39318\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x2020\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224469\x22,\x22lati\x22\x3A\x2248.864976\x22,\x22long\x22\x3A\x222.39871\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x205\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224471\x22,\x22lati\x22\x3A\x2248.846319\x22,\x22long\x22\x3A\x222.344516\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x207\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224472\x22,\x22lati\x22\x3A\x2248.856888\x22,\x22long\x22\x3A\x222.319964\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x208\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224473\x22,\x22lati\x22\x3A\x2248.877862\x22,\x22long\x22\x3A\x222.317804\x22\x7D,\x7B\x22name\x22\x3A\x22Antenne\x20de\x20Police\x209\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224474\x22,\x22lati\x22\x3A\x2248.872497\x22,\x22long\x22\x3A\x222.340366\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20d\x27ALFORTVILLE\x22,\x22id\x22\x3A\x225392\x22,\x22lati\x22\x3A\x2248.80529\x22,\x22long\x22\x3A\x222.420021\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20d\x27ARCUEIL\x22,\x22id\x22\x3A\x225032\x22,\x22lati\x22\x3A\x2248.805973\x22,\x22long\x22\x3A\x222.336826\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20ASNIERES\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224799\x22,\x22lati\x22\x3A\x2248.910354\x22,\x22long\x22\x3A\x222.289417\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20AUBERVILLIERS\x22,\x22id\x22\x3A\x224825\x22,\x22lati\x22\x3A\x2248.914652\x22,\x22long\x22\x3A\x222.381673\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BAGNEUX\x22,\x22id\x22\x3A\x224800\x22,\x22lati\x22\x3A\x2248.798652\x22,\x22long\x22\x3A\x222.304296\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BAGNOLET\x22,\x22id\x22\x3A\x224827\x22,\x22lati\x22\x3A\x2248.868921\x22,\x22long\x22\x3A\x222.417979\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BOIS\x20COLOMBES\x22,\x22id\x22\x3A\x224824\x22,\x22lati\x22\x3A\x2248.914476\x22,\x22long\x22\x3A\x222.267797\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20BOULOGNE\x20BILLANCOURT\x22,\x22id\x22\x3A\x224801\x22,\x22lati\x22\x3A\x2248.835388\x22,\x22long\x22\x3A\x222.24031\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CACHAN\x22,\x22id\x22\x3A\x224859\x22,\x22lati\x22\x3A\x2248.794443\x22,\x22long\x22\x3A\x222.331244\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHARENTON\x20LE\x20PONT\x22,\x22id\x22\x3A\x225395\x22,\x22lati\x22\x3A\x2248.819851\x22,\x22long\x22\x3A\x222.415667\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATENAY\x20MALABRY\x22,\x22id\x22\x3A\x224802\x22,\x22lati\x22\x3A\x2248.767087\x22,\x22long\x22\x3A\x222.277421\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATILLON\x22,\x22id\x22\x3A\x225382\x22,\x22lati\x22\x3A\x2248.799868\x22,\x22long\x22\x3A\x222.289823\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHATOU\x22,\x22id\x22\x3A\x224531\x22,\x22lati\x22\x3A\x2248.890074\x22,\x22long\x22\x3A\x222.157537\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CHOISY\x20LE\x20ROI\x22,\x22id\x22\x3A\x224861\x22,\x22lati\x22\x3A\x2248.762448\x22,\x22long\x22\x3A\x222.406938\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CLAMART\x22,\x22id\x22\x3A\x224803\x22,\x22lati\x22\x3A\x2248.800313\x22,\x22long\x22\x3A\x222.263162\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20CLICHY\x22,\x22id\x22\x3A\x224804\x22,\x22lati\x22\x3A\x2248.902389\x22,\x22long\x22\x3A\x222.304312\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20COLOMBES\x22,\x22id\x22\x3A\x224805\x22,\x22lati\x22\x3A\x2248.92276\x22,\x22long\x22\x3A\x222.254343\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20COURBEVOIE\x22,\x22id\x22\x3A\x224806\x22,\x22lati\x22\x3A\x2248.895463\x22,\x22long\x22\x3A\x222.2565\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20DRANCY\x22,\x22id\x22\x3A\x224831\x22,\x22lati\x22\x3A\x2248.925691\x22,\x22long\x22\x3A\x222.389513\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20FRESNES\x22,\x22id\x22\x3A\x225398\x22,\x22lati\x22\x3A\x2248.75534\x22,\x22long\x22\x3A\x222.322471\x22\x7D,\x7B\x22name\x22\x3A\x22mairie\x20de\x20Garches\x22,\x22id\x22\x3A\x225287\x22,\x22lati\x22\x3A\x2248.843147\x22,\x22long\x22\x3A\x222.186586\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20GENNEVILLIERS\x22,\x22id\x22\x3A\x224807\x22,\x22lati\x22\x3A\x2248.925846\x22,\x22long\x22\x3A\x222.294367\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20HOUILLES\x22,\x22id\x22\x3A\x224535\x22,\x22lati\x22\x3A\x2248.923084\x22,\x22long\x22\x3A\x222.186666\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20ISSY\x20LES\x20MOULINEAUX\x22,\x22id\x22\x3A\x224808\x22,\x22lati\x22\x3A\x2248.82423\x22,\x22long\x22\x3A\x222.273643\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20IVRY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224864\x22,\x22lati\x22\x3A\x2248.807809\x22,\x22long\x22\x3A\x222.374647\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20L\x27HAY\x20LES\x20ROSES\x22,\x22id\x22\x3A\x224868\x22,\x22lati\x22\x3A\x2248.778867\x22,\x22long\x22\x3A\x222.337234\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LA\x20COURNEUVE\x22,\x22id\x22\x3A\x224835\x22,\x22lati\x22\x3A\x2248.926341\x22,\x22long\x22\x3A\x222.391157\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LA\x20GARENNE\x20COLOMBES\x22,\x22id\x22\x3A\x224809\x22,\x22lati\x22\x3A\x2248.906762\x22,\x22long\x22\x3A\x222.246125\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20BOURGET\x22,\x22id\x22\x3A\x224837\x22,\x22lati\x22\x3A\x2248.934871\x22,\x22long\x22\x3A\x222.425765\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20PLESSIS\x20ROBINSON\x22,\x22id\x22\x3A\x224823\x22,\x22lati\x22\x3A\x2248.78248\x22,\x22long\x22\x3A\x222.262036\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LE\x20PRE\x20SAINT\x20GERVAIS\x22,\x22id\x22\x3A\x224838\x22,\x22lati\x22\x3A\x2248.883069\x22,\x22long\x22\x3A\x222.403281\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LES\x20LILAS\x22,\x22id\x22\x3A\x224840\x22,\x22lati\x22\x3A\x2248.880519\x22,\x22long\x22\x3A\x222.41849\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20LEVALLOIS\x22,\x22id\x22\x3A\x224810\x22,\x22lati\x22\x3A\x2248.893086\x22,\x22long\x22\x3A\x222.288514\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MALAKOFF\x22,\x22id\x22\x3A\x224811\x22,\x22lati\x22\x3A\x2248.820888\x22,\x22long\x22\x3A\x222.301668\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MEUDON\x22,\x22id\x22\x3A\x224812\x22,\x22lati\x22\x3A\x2248.812558\x22,\x22long\x22\x3A\x222.238593\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20MONTROUGE\x22,\x22id\x22\x3A\x224813\x22,\x22lati\x22\x3A\x2248.818705\x22,\x22long\x22\x3A\x222.319896\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20NANTERRE\x22,\x22id\x22\x3A\x224814\x22,\x22lati\x22\x3A\x2248.892044\x22,\x22long\x22\x3A\x222.205266\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20NEUILLY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224815\x22,\x22lati\x22\x3A\x2248.885111\x22,\x22long\x22\x3A\x222.266186\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20PANTIN\x22,\x22id\x22\x3A\x224845\x22,\x22lati\x22\x3A\x2248.896479\x22,\x22long\x22\x3A\x222.401907\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20PUTEAUX\x22,\x22id\x22\x3A\x224816\x22,\x22lati\x22\x3A\x2248.8843\x22,\x22long\x22\x3A\x222.236835\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20RUEIL\x20MALMAISON\x22,\x22id\x22\x3A\x224817\x22,\x22lati\x22\x3A\x2248.877939\x22,\x22long\x22\x3A\x222.180679\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20CLOUD\x22,\x22id\x22\x3A\x224818\x22,\x22lati\x22\x3A\x2248.843706\x22,\x22long\x22\x3A\x222.219356\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x2DDENIS\x22,\x22id\x22\x3A\x224851\x22,\x22lati\x22\x3A\x2248.936005\x22,\x22long\x22\x3A\x222.358906\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20MANDE\x22,\x22id\x22\x3A\x225407\x22,\x22lati\x22\x3A\x2248.843501\x22,\x22long\x22\x3A\x222.419041\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20MAURICE\x22,\x22id\x22\x3A\x224873\x22,\x22lati\x22\x3A\x2248.818091\x22,\x22long\x22\x3A\x222.423183\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SAINT\x20OUEN\x22,\x22id\x22\x3A\x224850\x22,\x22lati\x22\x3A\x2248.912188\x22,\x22long\x22\x3A\x222.333285\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SCEAUX\x22,\x22id\x22\x3A\x224819\x22,\x22lati\x22\x3A\x2248.778775\x22,\x22long\x22\x3A\x222.288772\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SEVRES\x22,\x22id\x22\x3A\x224820\x22,\x22lati\x22\x3A\x2248.824434\x22,\x22long\x22\x3A\x222.21308\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20SURESNES\x22,\x22id\x22\x3A\x224821\x22,\x22lati\x22\x3A\x2248.87113\x22,\x22long\x22\x3A\x222.224667\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20THIAIS\x22,\x22id\x22\x3A\x224875\x22,\x22lati\x22\x3A\x2248.765315\x22,\x22long\x22\x3A\x222.388829\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VANVES\x22,\x22id\x22\x3A\x224822\x22,\x22lati\x22\x3A\x2248.821396\x22,\x22long\x22\x3A\x222.289619\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VELIZY\x20VILLACOUBLAY\x22,\x22id\x22\x3A\x224558\x22,\x22lati\x22\x3A\x2248.782531\x22,\x22long\x22\x3A\x222.191265\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VILLEJUIF\x22,\x22id\x22\x3A\x224876\x22,\x22lati\x22\x3A\x2248.794931\x22,\x22long\x22\x3A\x222.366248\x22\x7D,\x7B\x22name\x22\x3A\x22mairie\x20de\x20Villeneuve\x2Dla\x2DGarenne\x22,\x22id\x22\x3A\x223990\x22,\x22lati\x22\x3A\x2248.935596\x22,\x22long\x22\x3A\x222.332934\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VIROFLAY\x22,\x22id\x22\x3A\x224559\x22,\x22lati\x22\x3A\x2248.799422\x22,\x22long\x22\x3A\x222.172793\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20de\x20VITRY\x20SUR\x20SEINE\x22,\x22id\x22\x3A\x224878\x22,\x22lati\x22\x3A\x2248.788757\x22,\x22long\x22\x3A\x222.38929\x22\x7D,\x7B\x22name\x22\x3A\x22Mairie\x20LE\x20KREMLIN\x20BICETRE\x22,\x22id\x22\x3A\x225400\x22,\x22lati\x22\x3A\x2248.812652\x22,\x22long\x22\x3A\x222.356646\x22\x7D,\x7B\x22name\x22\x3A\x22Pr\x5Cu00e9fecture\x20de\x20Police\x20\x20\x2D\x20Site\x20de\x20Gesvres\x204\x5Cu00e8me\x20arrondissement\x22,\x22id\x22\x3A\x224470\x22,\x22lati\x22\x3A\x2248.856894\x22,\x22long\x22\x3A\x222.348783\x22\x7D\x5D";
var_dump(json_decode($string,true));
The above code works OK for me. Good luck!!

PHP Serialize($array) without dumping array info a:1:{i:0;s:4.... and so on

Is there anything that i print the string without the array information?
(Without this: a:1:{i:0;s:4011:" ";} )?
The whole array must be in single variable and printed. Foreach doesn't help, neither print(array[0]).
You can use json_encode() which will give you less verbose string representation:
<?php
$a = array('a', 'bb' => 'ccc');
echo json_encode($a);
// outputs {"0":"a","bb":"ccc"}
You can use
echo json_encode($array);
This will print a json encoded string.
For you to decode it you can use
json_decode(json encoded string);
You can see docs of php about json encode and json decode

JSON result formatting error

My JSON Value is like this -
$arr2 = array('dn'=>'NR/2014/02/1257','dd'=>'1393934346');
$arr=array('id'=>'123456','fname'=>'ABC','lname'=>'XYZ','dt'=>array($arr2));
$json = json_encode($arr));
RESULT -
{
"id":"123456","fname":"ABC","lname":"XYZ",
"dt":[
{"dn":"NR\/2014\/02\/1257","dd":1393934346}
]
}
In which dn value is NR\/2014\/02\/1257 but I want the dn value to be NR/2014/02/1257 as per my real dn value.
Can anybody help me???
You should make use of the JSON_UNESCAPED_SLASHES as a parameter to ur json_encode() function. Available since PHP 5.4.0.
<?php
$arr2 = array('dn'=>'NR/2014/02/1257','dd'=>'1393934346');
$arr=array('id'=>'123456','fname'=>'ABC','lname'=>'XYZ','dt'=>array($arr2));
echo $json = json_encode($arr,JSON_UNESCAPED_SLASHES);
OUTPUT :
{"id":"123456","fname":"ABC","lname":"XYZ","dt":[{"dn":"NR/2014/02/1257","dd":"1393934346"}]}
Demo
Turnaround for PHP versions less than 5.4.0, that doesn't support JSON_UNESCAPED_SLASHES , Doing a simple replace of backslashes does the job.
echo $json = str_replace('\\','',json_encode($arr));
You could set the JSON_UNESCAPED_SLASHES parameter when using json_encode() function (PHP version have to >= 5.4).
But the string "NR\/2014\/02\/1257" is exactly same with "NR/2014/02/1257", so the JSON_UNESCAPED_SLASHES is not necessary.
console.log("NR\/2014\/02\/1257" === "NR/2014/02/1257"); //true
But if you put the json string inside a <script> tag, which doesn't allow </ inside the strings, so it is much safer to escape the /.
$json =json_encode($arr, JSON_UNESCAPED_SLASHES);
use JSON_UNESCAPED_SLASHES
$arr2 = array('dn'=>'NR/2014/02/1257','dd'=>'1393934346');
$arr=array('id'=>'123456','fname'=>'ABC','lname'=>'XYZ','dt'=>array($arr2));
$json = json_encode($arr, JSON_UNESCAPED_SLASHES));
It is one of the predefined json constants in php http://www.php.net/manual/en/json.constants.php
var obj = jQuery.parseJSON(jsondata);

PHP: json_encode changing slash to \/

I have a variable which contains a path in json_encode
/users/crazy_bash/online/test/
but json_encode converts the path to this:
\/users\/crazy_bash\/online\/test\/
Why? How can i display a normal path?
the code
$pl2 = json_encode(array(
'comment' => $nmp3,
'file' => $pmp3
));
echo($pl2);
It's perfectly legal JSON, see http://json.org/. \/ is converted to / when unserializing the string. Why worry about it if the output is unserialized by a proper JSON parser?
If you insist on having \/ in your output, you can use str_replace():
// $data contains: {"url":"http:\/\/example.com\/"}
$data = str_replace("\\/", "/", $data);
echo $data; // {"url":"http://example.com/"}
Note that it's still valid JSON by the definition of a string:
(source: json.org)
Escaped solidus is legal. But if you want a result without escaping, use JSON_UNESCAPED_SLASHESin json_encode option. However, this was added after PHP 5.4.
So, str_replace('\\/', '/', $pl2); would be helpful.
You'll have to decode it before usage.
json_decode()
That's what json_encode is supposed to do. Once you json_decode or JSON.parse it, it's fine.
var f = {"a":"\/users\/crazy_bash\/online\/test\/"}
console.log(f.a); // "/users/crazy_bash/online/test/"
var h = JSON.parse('{"a":"\/users\/crazy_bash\/online\/test\/"}');
console.log(h.a); // "/users/crazy_bash/online/test/"
I had the same problem, basically you need to decode your data and then do the encode, so it works correctly without bars, check the code.
$getData = json_decode($getTable);
$json = json_encode($getData);
header('Content-Type: application/json');
print $json;

Categories