Android Question (RuntimeException) java.lang.RuntimeException: JSON Array expected.

Alexander1981

Member
Licensed User
<?php
$sede = $_GET["sede"];
$espe = $_GET["espe"];
$json_url = "http://192.168.x.x/data.php?sede=".$sede."&espe=".$espe;
$json = file_get_contents($json_url);
print $json;
?>

when I consult the page by a browser if it shows the data in json
http://192.168.x.x/data.php?sede=xxx&espe=xx

[{"num_expediente":"05079-2014-21-0401-JR-PE-03","h_inicio":"15:20:00","h_termino":"16:29:00","x_audiencia":"CONTINUACION DE JUICIO ORAL","x_instancia":"1","x_sala_audiencia":"SALA DE AUDIENCIAS 20 - EXTINCION DE DOMINIO"}]



B4A
Dim PageServer As String = "http://192.168.x.x/data.php"
PageServer = "http://192.168.x.x/data.php"
js.download2(PageServer, Array As String ("sede","xxx","espe","xx"))

(RuntimeException) java.lang.RuntimeException: JSON Array expected.
 

OliverA

Expert
Licensed User
Longtime User
Your not giving us the code that is causing this exception. Run your B4A app in debug mode and see where in your code the exception happens. Post the problem code. Looking at the exception, it seems to involve JSONParser
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Try adding a LOG of the serveranswer before you are feeding the json-parser.
B4X:
if job.success then
log(job.GetString)
else
log(job.errormessage)
end if

Based on the error it does look like being not a json-result.
 
Upvote 0
Top