json vars on latte templates

Notice: This thread is very old.
alnux
Member | 139
+
0
-

hi there im traying to load a json string into a javascript var

<script>
example = "{1: 3.5,2: 2.5}";
</script>

but when i try to render it on browser it show me the next error

Latte\CompileException

Do not place {1: 3.5,2: 2.5} inside quotes in …/view/empresaventaviewform.latte:51

how can i load json vars into javascripts

really thanks

David Matějka
Moderator | 6445
+
+2
-

you can use syntax macro or special macros {l} and {r} which just print { and }. Also it works if you place a space after opening {