1 post tagged “api”
i had a error when i parsed JSON.
i am using module of the WebService::Simple to send request to Google Ajax Search API.
try below codes, for example.
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use WebService::Simple;
use WebService::Simple::Parser::JSON;
use Data::Dumper;my $q = 'ケーキ www.bob-an.com/recipe/OutputMain.asp?KeyNo=15711';
my $parser = WebService::Simple::Parser::JSON->new;
$parser->{json}->utf8(1);my $google = WebService::Simple->new(
base_url => 'http://ajax.googleapis.com/ajax/services/search/web',
response_parser => $parser,
params => {
q => $q,
v => '1.0',
rsz => 'large',
lr => 'lang_ja',
},
);my $req = $google->get;
my $res = $req->parse_response;print Dumper($res);
this is the error.
illegal backslash escape sequence in string, at character offset 383 (before "\\\x{30af}\x{30ea}\x{30b9}...") at /usr/lib/perl5/site_perl/5.8.6/WebService/Simple/Parser/JSON.pm line 27.
illegal backslash escape sequence...
if the query changed, it is alright.
my $q = 'www.bob-an.com/recipe/OutputMain.asp?KeyNo=15711';
why? why? why?
it seems bad around '</b>' i guessed.
however i can not solve it.
please, help me.