I was sending the string I mentioned starting with "var Categories = ....".<br>Looks like I somehow need to translate the Categories and DB to some json tree, but I don't know how to do it.<br>For output I need a lisp list/tree structure describing the same data something like<br>
'(:category "Cat1" (:name "Item1" :item-num 8) (:name "Item2" :iten-num 9)).<br>Should I resort to flex/bison or I can just use the libraries available for common lisp?<br> <br>Thank you,<br>
Andrew<br><br><div><span class="gmail_quote">On 6/10/08, <b class="gmail_sendername">Henrik Hjelte</b> <<a href="mailto:henrik@evahjelte.com">henrik@evahjelte.com</a>> wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
Hmm, what exactly are you parsing?<br> Javascript? No in that case it can't be parsed. Not that json is not<br> javascript, it is a subset of the javascript object notation.<br><br> What exaclty are you sending, in a string, to lisp?<br>
<br> Categories is an array, and DB is an object, so both have to be<br> encoded to json. I would use some json client side library for that<br> purpose. They are all around, in Dojo or Prototype or stand alone.<br><br> Best wishes,<br>
 Henrik Hjelte<br><br> On Tue, Jun 10, 2008 at 12:46 AM, Andrei Stebakov <<a href="mailto:lispercat@gmail.com">lispercat@gmail.com</a>> wrote:<br><br>> I have a web page which has a JavaScript defining some data in a form:<br>
 ><br> > var Categories = [<br> >               {name:"Cat1 ", caption:escape("Category 1")},<br> >               {name:"Cat2 ", caption:escape("Category 2")}<br> ><br>
 >                ];<br> ><br> >       var DB = new Object();<br> >       DB[Categories[0].name] = [<br> >            {name:escape("Item1"), item-num:8}<br> >         ];<br> ><br> > etc...<br>
 ><br> ><br> > When I try to parse it with cl-json (using decode-json-from-string), I got<br> > errors because it can't accept things like variable definitions.<br> > Can I use cl-json to create a CL data from the JS data I mentioned or I<br>
 > should use some other tool?<br> ><br> > Thank you,<br> > Andrew<br> ><br> ><br><br>> _______________________________________________<br> > cl-json-devel mailing list<br> > <a href="mailto:cl-json-devel@common-lisp.net">cl-json-devel@common-lisp.net</a><br>
 > <a href="http://common-lisp.net/cgi-bin/mailman/listinfo/cl-json-devel">http://common-lisp.net/cgi-bin/mailman/listinfo/cl-json-devel</a><br> ><br> ><br><br><br><br> --<br> Henrik Hjelte<br> <a href="mailto:henrik.hjelte@stix.to">henrik.hjelte@stix.to</a><br>
 +46703993945<br> <a href="http://stix.to">http://stix.to</a><br> Lästmakarg 18-20 (IQube)<br> Box 7438<br> S-103 91 Stockholm<br> Sweden<br> _______________________________________________<br> cl-json-devel mailing list<br>
 <a href="mailto:cl-json-devel@common-lisp.net">cl-json-devel@common-lisp.net</a><br> <a href="http://common-lisp.net/cgi-bin/mailman/listinfo/cl-json-devel">http://common-lisp.net/cgi-bin/mailman/listinfo/cl-json-devel</a><br>
</blockquote></div><br>