JavaScript::Dumper - Dump JavaScript data structures from Perl objects. Allows unquoted strings and numbers.


JavaScript-Dumper documentation  | view source Contained in the JavaScript-Dumper distribution.

Index


NAME

Top

JavaScript::Dumper - Dump JavaScript data structures from Perl objects. Allows unquoted strings and numbers.

SYNOPSIS

Top

 use JavaScript::Dumper;

 my $js = js_dumper([{foo => "bar", number => 12345, boolean => \1, call => \"function"}]);

 # results in:
 # $js = "[{"foo": "bar", "number" => 12345, "boolean" => true, "call": function}]"; 

DESCRIPTION

Top

This module uses JSON::PP as base and overrides value_to_json to accept SCALAR-refs to be returned without quotes.

FUNCTIONS

Top

js_dumper

Dumps any perl data structure.

  \'1' becomes "true"

  \'0' becomes "false"

See JSON::PP or JSON::XS for more details.

METHODS

Top

new

Returns JavaScript::Dumper object.

others

For all other methods see JSON::PP and JSON::XS.

CAVEATS

Top

JavaScript::Dumper is as slow as JSON::PP. You might want to cache the output or use it only for small objects.

TODO

Top

JavaScript::Dumper::XS

Find someone who does a speedy version of this module

SEE ALSO

Top

JSON::PP, JSON::XS

AUTHOR

Top

Moritz Onken (perler)

COPYRIGHT AND LICENSE

Top


JavaScript-Dumper documentation  | view source Contained in the JavaScript-Dumper distribution.