Thread Wagenanzeige Raspberry Pi
(73 answers)
Opened by NIwu at 2014-10-25 13:58
Hallo
was bedeutet das denn ? malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at D:/webserver/xampp/cgi-bin/cgi.cgi line 104. hier der orig string my $abfahrenString = '[["S3","Dresden, Plauen","1"],["S1","Dresden, Flughafen","2"],["RE01","Meissen","10"],["ICE","Hamburg, Neugraben","15"]]'; my @keys = qw(ZugNr Richtung Minuten); my @abfahrten = sort { $a->[2] <=> $b->[2] } @{decode_json $abfahrenString}; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', "\n"; print "<html><head><title>Test-Ausgabe</title></head><body>\n"; print "\n"; print "<table><tr>"; print "<th>$_</th>" for @keys; print "</tr>\n"; for my $zug (@abfahrten) { print "<tr>"; print "<td>$_</td>" for @$zug; print "</tr>\n"; } print "</table></body></html>\n"; hier der geƤnderte String, my $abfahrenString = [["$content"]]; my @keys = qw(ZugNr Richtung Minuten); my @abfahrten = sort { $a->[2] <=> $b->[2] } @{decode_json $abfahrenString}; print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">', "\n"; print "<html><head><title>Test-Ausgabe</title></head><body>\n"; print "\n"; print "<table><tr>"; print "<th>$_</th>" for @keys; print "</tr>\n"; for my $zug (@abfahrten) { print "<tr>"; print "<td>$_</td>" for @$zug; print "</tr>\n"; } print "</table></body></html>\n"; |