Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
And the output should look like this:my $data = { age=>18, handler=>\"function(){ alert('hello, worldly') }" }; my $json = encode_json( $data )
{ age: 18, handler: function(){ ... } }
I know I've seen something that can do that somewhere. I think the usual implementation would use scalar references (ie \"function(){ }") to achieve this. But none of the regular JSON modules seem to accept it.
Any clues?
Thanks,
miguel
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Javascript in your JSON
by derby (Abbot) on Apr 08, 2009 at 12:09 UTC | |
by Anonymous Monk on Apr 08, 2009 at 19:08 UTC | |
by ikegami (Patriarch) on Apr 08, 2009 at 19:14 UTC | |
by derby (Abbot) on Apr 08, 2009 at 19:30 UTC | |
|
Re: Javascript in your JSON
by Anonymous Monk on Apr 08, 2009 at 10:02 UTC | |
|
Re: Javascript in your JSON
by Anonymous Monk on Apr 09, 2009 at 09:46 UTC |