Up: Chapter 19

19.1 Problem

What am I doing wrong? I’m trying to output a javascript object into the page (so my front end guy can do some stuff with the data without parsing it out of elements by id) but it’s replacing all the double quotes with " (only in view source - if I inspect it then firebug converts them to double quotes again)
I’ve copied the example from Exploring Lift, but it still does the same:
& ".data_as_object *" #> {
   JsCrVar("myObject", JsObj(("persons", JsArray(
       JsObj(("name", "Thor"), ("race", "Asgard")),
       JsObj(("name", "Todd"), ("race", "Wraith")),
       JsObj(("name", "Rodney"), ("race", "Human"))
   ))))
Becomes:
<div class="data_as_object" style="display: none;">var myObject =
{&quot;persons&quot;: [{&quot;name&quot;: &quot;Thor&quot;,
&quot;race&quot;: &quot;Asgard&quot;}, {&quot;name&quot;:
&quot;Todd&quot;, &quot;race&quot;: &quot;Wraith&quot;},
{&quot;name&quot;: &quot;Rodney&quot;, &quot;race&quot;:
&quot;Human&quot;}]
};</div>
I’ve noticed that if what I’m outputting is a number rather than a string then it’s fine.
Up: Chapter 19

(C) 2012 David Pollak