I have problem with JSON, passing html code, I don't understand because I escaped with addslashes php function.
This is the JSON that fail:
With php JSON is valid:
<?php if(count($articles)): ?>
{"items":[
<?php foreach($articles as $key => $article): ?>
<?php if($key==0 ):?>
{
"foto_g": "<?php echo $article->getRutafoto() ?>",
"foto_th": "<?php echo $article->getRutathumb() ?>"
}
<?php else: ?>
,
{
"foto_g": "<?php echo $article->getRutafoto() ?>",
"foto_th": "<?php echo $article->getRutathumb() ?>"
}
<?php endif ?>
<?php endforeach ?>
],
"nom_coleccio": "<?php echo $coleccio->getNom()?>"
,
"descripcio_coleccio": "<?php echo addslashes($coleccio->getDescripcio(ESC_RAW))?>"
}
<?php endif ?>
And the result that have problem is:
{
"descripcio_coleccio": "<p>El delta de l\'Ebre ha estat l\'escenari d\'inspiració d\'aquesta col·lecció.</p>
<p>La línia de l\'horitzó i el color del paisatge materialitzats en alumini s\'uneixen per a crear volum en forma de joia.</p>"
}
When is the problem?
Thanks Regards
"double quotes.