{[
{'firstName':'John',
'lastName':'Doe',
'text' : 'Text with
new lines and tabs'
},
{'firstName':'Anna',
'lastName':'Smith',
'text' : 'text with ''2 single quotes togeether '' and "Double quotes either in pairs" or in ""Double pairs"" '
},
{'firstName':'Peter',
'lastName':'O'Toole',
'text' : "More text with diacritics'
]}
####
$json->allow_singlequote->decode({'foo':'bar'});
####
use strict; use warnings;
use JSON -support_by_pp;
my $content = qq(
{[
{'firstNameA' : 'John',
'lastName' : 'Doe',
'text' : 'Text with
new lines and tabs'
},
{'firstNameB' : 'Anna',
'lastName' : 'Smith',
'text' : 'text with ''2 single quotes togeether '' and "Double quotes either in pairs" or in ""Double pairs"" '
},
{'firstNameC' : 'Peter',
'lastName' : 'O'Toole',
'text' : "More text with diacritics'
]}
);
print $content;
my $json = new JSON;
my $json_text = $json->allow_nonref->utf8->relaxed->escape_slash->loose->allow_singlequote->decode($content);