[Catalyst] Re: need JSON converter which supports unquoted strings

A. Pagaltzis pagaltzis at gmx.de
Mon Nov 19 14:50:25 GMT 2007


* Moritz Onken <onken at houseofdesign.de> [2007-11-19 15:30]:
> sorry, a bit off topic, but I'm looking for a
> perl-object-to-JSON converter which supports unquoted strings.

Derived though from Javascript as it may be, JSON is not
Javascript, and there is no such thing in JSON as an unquoted
(or single-quoted) string.

> Modules like JSON::Any quote everything except true and false.

Now you know why.

> But I need to pass unquoted strings to let JavaScript run some
> functions.
> 
> Any suggestions?

Dump your data structure to JSON incrementally and interpolate
the JSON snippets into a template that generates Javascript which
does whatever you need to build the final data structure. (You’re
generating Javascript and not JSON anyway.)

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>



More information about the Catalyst mailing list