Well, Jeppe already knew about JSON since he's using it already. And there are other modules that do the same thing (JSON::DWIM will work the same on blessed or not blessed objects for exemple). But as far as I understand the issue here is to escape some chars (the single quote at least apparently) in strings. And unlike Data::Dump, JSON doesn't seem to provide a call back to allow custom output for any data type (objects can have a method to convert themselves to JSON, but here the strings are not blessed).
Jeppe, wouldn't s/'/\\'/g; on the output JSON be enough?
In reply to Re^2: Perl structure to Javacript-ready JSON
by Eily
in thread Perl structure to Javacript-ready JSON
by Jeppe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |