28 Sep 2014 07:42:10 UTC
- Distribution: JSON-T
- Module version: 0.104
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (475 / 0 / 0)
- KwaliteeBus factor: 1
- 48.39% Coverage
- License: lgpl_2_1
- Perl: v5.10.0
- Activity24 month
- Download (27.88KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- SEE ALSO
- COPYRIGHT AND LICENCE
- DISCLAIMER OF WARRANTIES
JSON::T - transform JSON using JsonT
my $jsont = slurp('foo/bar.js'); my $input = slurp('foo/quux.json'); my $JSONT = JSON::T->new($jsont); print $JSONT->transform($input);
This module implements JsonT, a language for transforming JSON-like structures, analogous to XSLT in the XML world.
This module tries to provide a similar API to XML::Saxon::XSLT2.
will try to pick a working implementation for you.
parameters(param1=>$arg1, param2=>$arg2, ...)
Run the transformation. The input may be a JSON string, a JSON::JOM::Node or a native Perl nested arrayref/hashref structure, in which case it will be stringified using the JSON module's to_json function. The output (return value) will be a string.
transform, but attempts to parse the output as a JSON string and return a native Perl arrayref/hashref structure. This method will fail if the output is not a JSON string.
Like UNIVERSAL's DOES method, but returns true for:
as an aid for polymorphism.
The following methods also exist for compatibility with XML::Saxon::XSLT2, but are mostly useless:
A single global object called "JSON" is provided with methods
parsecompatible with the well-known json2.js library (http://www.JSON.org/json2.js), and a method
print_to_perlis provided which prints to Perl's STDOUT stream.
Will be passed a newly created object (let's call it
return_to_perl(which acts as a shim to
print_to_perl(which acts as a shim to
Will be passed an object (
This one is optional to implement it. If you don't implement it, then users will get a warning message if they try to call
parameterson your subclass.
Will be passed an object (
$self) and a hash of parameters, using the following format:
( name1 => 'value1', name2 => [ type2 => 'value2' ], name3 => [ type3 => 'value3', hint => 'hint value' ], )
This should have the effect of setting:
var name1 = 'value1'; var name2 = 'value2'; var name3 = 'value3';
You are unlikely to need to do anything else when subclassing.
If you wish
JSON::T->newto know about your subclass, then push its name onto
Please report any bugs to http://rt.cpan.org/.
Toby Inkster <email@example.com>.
Copyright 2006 Stefan Goessner.
Copyright 2008-2011, 2013-2014 Toby Inkster.
Licensed under the Lesser GPL: http://creativecommons.org/licenses/LGPL/2.1/.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.