« Cleaning Up Bad HTML in Perl, Take 2 Other Public Domain Reprints Services »
Converting JSON to XML with Perl
Posted February 11, 2009 – 9:55 pm by Yakov Shafranovich in WebsiteRecently I had to work with Google AJAX API data which returns in JSON. For my purposes, the data needed to be in XML. While there is a CPAN module called XML2JSON which is designed to do that, for some reason it chokes on my input. Instead, I adopted a much more simple technique from the Google::Data::JSON module as follows:
use JSON::Any; use XML::Simple; my $convertor = JSON::Any->new(); my $data = $convertor->decode($json); my $xml = XMLout($data);
Permalink | Trackback URL | This post has