in reply to Re^3: Perl Database Entries
in thread Perl Database Entries
$api_results contents are below 100442,"spredfast-tim-hortons","Spredfast - Tim Hortons",5561,"Spredfa +st",false,false,"timhortons@icuc.social","https://www.spredfast.com", +"2017-03-03T09:52:30.440-08:00","active",false,false,"shared"
My new code is below
use JSON; my $json=new JSON; my @unjson=$json->allow_nonref->decode($api_results); $app_insert = $dbh->prepare("INSERT INTO bitium_apps(id, app_slug, ap +p_Name, team_id, provider_id, provider_slug, provider_saml, config_saml, confi +g_login, config_url, created_date, status, key_vault, mfa_code, configuration_i +nstall) VALUES (?, ?, ?, \"$response\", ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?") o +r die $dbh->errst$ for my $row (@unjson) { my @insert; for my $var (qw/.id, .slug, .name, .provider.id, .provider.name, .provider.capabilities.has_saml, .configuration.sa +ml, .configuration.login, .configuration.url, .created +_at, .status, .key_vault, .requires_mfa_code, .configur +ation.install_type /){ push @insert,$row->{$var}; } # var $app_insert->execute(@insert[0,1,2,4 .. 15]) or die $app_insert->e +rrstr; } # row
But I get the following error: garbage after JSON object, at character offset 7 (before ""spredfast-tim-horto...") at bitium.pl line 69. line 69 is my @unjson=$json->allow_nonref->decode($api_results);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Perl Database Entries
by huck (Prior) on Jul 16, 2017 at 05:34 UTC | |
by cbtshare (Monk) on Jul 16, 2017 at 06:51 UTC | |
by huck (Prior) on Jul 16, 2017 at 08:15 UTC | |
by cbtshare (Monk) on Jul 16, 2017 at 20:39 UTC | |
by huck (Prior) on Jul 16, 2017 at 21:39 UTC | |
| |
by poj (Abbot) on Jul 16, 2017 at 08:15 UTC | |
by cbtshare (Monk) on Jul 16, 2017 at 20:42 UTC |