in reply to Re: Perl structure to Javacript-ready JSON
in thread Perl structure to Javacript-ready JSON
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Perl structure to Javacript-ready JSON
by LanX (Saint) on Nov 25, 2014 at 16:00 UTC | |
by Eily (Monsignor) on Nov 25, 2014 at 16:12 UTC | |
by LanX (Saint) on Nov 25, 2014 at 16:45 UTC |