I'm facing a problem when trying to inject a string from PHP (using the Laravel framework) into javascript.
The string is like [{"foo1": bar1}, {"foo2" : bar2}].
When I inject this string to javascript using something like var test = '{{ $var }}' the " are converted to ". The javascript string is used in a function later to parse the JSON. This now fails because of the quote-conversion.
It seems that the string is passed into the browser as it should be. But Chrome converts it.
How can I solve this? I've tried PHP's str_replace(), html_entity_decode(), json_encode() and Javascript's replace(). Both aren't solving the issue.
{{ }}syntax suggests some kind of template engine. You'll need to provide more information about what that is.