#!/usr/bin/perl -- use strict; use warnings; use JSON; Main( @ARGV ); exit( 0 ); sub Main { my $json = <<'__JSON__'; {"res":{ "url":"http://www.abc.org/", "title":"extracting data using JSON ", "snippet":"valuable information using JSON ", "meta":{"xy_suburl":"/abstract/123.htm","xy_keywords":" JSON","hj_year":"2009" }}} __JSON__ my $perl_scalar = JSON->new->decode($json); print JSON->new->utf8(1)->pretty(1)->encode($perl_scalar); print $perl_scalar->{res}{title}, "\n"; } __END__