1NAME 2 JSON::Any - Wrapper Class for the myriad JSON classes. 3 4VERSION 5 Version 1.00 6 7SYNOPSIS 8 This module will provide a coherent API to bring together the various 9 JSON modules currently on CPAN. 10 11 use JSON::Any; 12 13 my $j = JSON::Any->new; 14 15 $json = $j->objToJson({foo=>'bar', baz=>'quux'}); 16 17 $obj = $j->jsonToObj($json); 18 19 or without creating an object: 20 21 $json = JSON::Any->objToJson({foo=>'bar', baz=>'quux'}); 22 23 $obj = JSON::Any->jsonToObj($json); 24 25 JSON::Any currently only implements converting back and forth between 26 JSON and hashrefs. There is considerably more functionality in many of 27 the JSON modules. Ability to access these will be provided in subsequent 28 versions of JSON::Any. 29 30 On load, JSON::Any will find a valid JSON module in your @INC by looking 31 for them in this order: 32 33 JSON::XS 34 JSON 35 JSON::DWIW 36 JSON::Syck 37 38 And loading the first one it finds. 39 40 You may change the order by specifying it on the "use JSON::Any" line: 41 42 use JSON::Any qw(DWIW Syck XS JSON); 43 44 Specifying an order that is missing one of the modules will prevent that 45 module from being used: 46 47 use JSON::Any qw(DWIW XS JSON); 48 49 This will check in that order, and will never attempt to load 50 JSON::Syck. 51 52FUNCTIONS 53 "new" 54 There are currently no arguments to "new" 55 56 "handlerType" 57 Takes no arguments, returns a string indicating which JSON Module is in 58 use. 59 60 "objToJson" 61 Takes a single argument, a hashref to be converted into JSON. It returns 62 the JSON text in a scalar. 63 64 "jsonToObj" 65 Takes a single argument, a string of JSON text to be converted back into 66 a hashref. 67 68AUTHOR 69 Chris Thompson, "<cthom at cpan.org>" 70 71BUGS 72 Please report any bugs or feature requests to "bug-json-any at 73 rt.cpan.org", or through the web interface at 74 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=JSON-Any>. I will be 75 notified, and then you'll automatically be notified of progress on your 76 bug as I make changes. 77 78ACKNOWLEDGEMENTS 79 This module came about after discussions on irc.perl.org about the fact 80 that there were now six separate JSON perl modules with different 81 interfaces. 82 83 In the spirit of Class::Any, I have created JSON::Any with the 84 considerable help of Chris 'Perigrin' Prather, and Matt 'mst' Trout. 85 86COPYRIGHT & LICENSE 87 Copyright 2007 Chris Thompson, all rights reserved. 88 89 This program is free software; you can redistribute it and/or modify it 90 under the same terms as Perl itself. 91 92