[Koha] JSON parsing problem with KOha 24.05

Alvaro Cornejo cornejo.alvaro at gmail.com
Wed Oct 9 17:57:03 NZDT 2024


Hi All

We are still preparing the migration from 19.11 to 24.05

We are testing some parsing some reports through JSON that work in 19.11
but does not in 24.05.

The snippet where we think there is a problem is:

In 19.11 this works fine. We get the values and we can do the magic we need

36 my $url30 = "https://XXX/cgi-bin/koha/svc/report?id=87";
37 my $request30 = HTTP::Request->new("GET" => $url30);
38 my $response30 = $ua->request($request30);
39
40 use JSON;
41 my $json_obj30 = JSON->new->utf8->decode($response30->content);
42
43 # Gives the number of rows (30 days) in the array
44 my $row_num30 = scalar(@{$json_obj30});
45 print scalar(@{$json_obj30}), " rows30\n";


However, the same code in 24.05 give us the following error:

acornejo at Koha24:~/perl$ sudo perl TablaEventos.pl

Ejecutando TablaEventos-84
malformed JSON string, neither tag, array, object, number, string or atom,
at character offset 0 (before "Can't connect to bib...") at TablaEventos.pl
line 41.
acornejo at Koha24:~/perl$

Line 41 correspond to:
41  my $json_obj30 = JSON->new->utf8->decode($response30->content);

Any idea what could be wrong?

Regards

Alvaro








|----------------------------------------------------------------------------------------|
 Stay safe / Cuídate/  Reste sécurisé
*7* Switch off as you go / Apaga lo que no usas /  Débranchez au fur et à
mesure.
 *q *Recycle always / Recicla siempre / Recyclez toujours
 P Print only if absolutely necessary / Imprime solo si es necesario /
Imprimez seulement si nécessaire


More information about the Koha mailing list