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