I have a Twig array like this:
var settings = JSON.parse('{{ theme | json_encode | raw }}');
For example as a result I get this:
var settings = JSON.parse('{"text_color":"#444444","company_info":"my company profile with a comma's"}');
What happens now is that when somebody write at company profile something with a comma or any other character the complete script breaks.
Example's: - 'something' - thing's - awesome;
Is there a way to "accept" these special characters? I thought encode would read past those characters?!
Aucun commentaire:
Enregistrer un commentaire