I was trying to get a json in an javascript variable. I use fluid-templates in my extbase typo3-extension. In my action I load some json with curl. This json I assign to the template. In my template it looks like:
<script type="text/javascript">
var json = {jsonVarFromControllerAction};
</script>
In this case the json is interpreted as html-code. It looks like:
{"content":"testcontent"}
In the controller-action its an correct json!
{"content": "testcontent"}
Whats the solution?
I wrote my own viewhelper. This viewhelper only gets the json-content and html_entity_decode it.
It works well, but i ask myself, why i should write an helper to get the pure content of my own variables?