[Seaside] JSON encoding help.

Nick Ager nick.ager at gmail.com
Wed Jun 23 07:07:29 UTC 2010


Hi Paul,

Did you solve this problem? If not perhaps there's no need to encode the
elements of the Dictionary separately. Perhaps something like:


renderContentOn: html
|event1 events|

event1:=Dictionary new.
event1 at: 'title' put:'event1'.
event1 at:'start' put:'2010-06-20'.

html div
   id:'calendar';
   script: (html jQuery this fullCalendar theme:true).
   html script:( (html jQuery id:'calendar') fullCalendar events:(event1
asJson) )

or even try without the asJson.

It looks as though your Dictionary is Jsonified/Javascriptified three times.

Compare the output of:

event1:=Dictionary new.
event1 at: 'title' put:'event1'.
event1 at:'start' put:'2010-06-20'.
event1 asJson

with:

event1:=Dictionary new.
event1 at: 'title' put:'event1'.
event1 at:'start' put:'2010-06-20'.
event1 asJson asJson asJson

Hope this helps

Nick

On 20 June 2010 17:22, Paul DeBruicker <pdebruic at gmail.com> wrote:

> Hi -
>
> I'm trying to generate a JSON array and can't figure out how to get rid of
> the escaped double quote characters.
>
> When I do this:
>
> renderContentOn: html
> |event1 events|
>
> event1:=Dictionary new.
> event1 at: 'title' put:'event1'.
> event1 at:'start' put:'2010-06-20'.
>  events:= String streamContents: [:stream | event1 jsonOn: stream].
>
> html div
>    id:'calendar';
>    script: (html jQuery this fullCalendar theme:true).
>    html script:( (html jQuery id:'calendar') fullCalendar events:(Array
> with:events) )
>
>
> in the web page I get:
>
>
> $("#calendar").fullCalendar("{\"events\":[\"{\\\"title\\\":\\\"event1\\\",\\\"start\\\":\\\"2010-06-20\\\"}\"]}")
>
>
> but what I seem to need to get the jQuery  FullCalendar (
> http://arshaw.com/fullcalendar/)  plug-in to work is this:
>
> $("#calendar").fullCalendar({events:[{title:"event1",start:"2010-06-20"}]})
>
>
> Thanks for any guidance you can provide...
>
>
> Paul DeBruicker
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20100623/568b4fd1/attachment-0001.htm


More information about the seaside mailing list