Separate content from Response Content

1-Your php return is right?
2- Click and DO IT on the blue block ā€œlist of pairs to ā€¦ā€

What do you get as a result?

3- Click on DO IT in the blocks below: Get Value for Keyā€¦

Using a Json:
[{ā€œplate_numā€:ā€œ30ā€,ā€œb_classā€:ā€œClass 3 Unitā€,ā€œb_depā€:ā€œ9:30ā€,ā€œb_arrivā€:ā€œ11:30ā€,ā€œb_drivā€:ā€œArnel Ignacioā€},
{ā€œplate_numā€:ā€œ20ā€,ā€œb_classā€:ā€œClass 5 Unitā€,ā€œb_depā€:ā€œ8:30ā€,ā€œb_arrivā€:ā€œ12:30ā€,ā€œb_drivā€:ā€œJuan Pedroā€}]
and Lookup Pairs Key Block

:point_up:

4 Likes

The Do It is not working for me idk y :cold_sweat:

Connect to Companionā€¦
Check your JSON return from your PHP :

my companion always stops, Iā€™m just using an emulator

:point_down:

I already adjusted that blocks awhile ago this is now my current blocks:


and I always got this:

Did you check your Json here ?
:point_down:

can you share your AIA? post it here or at least share your API endpoint

Yes and this is the result:

{
   "bus":[
      {
         "Bus_Plate_Number":"30",
         "Bus_Class":"Class 3 Unit",
         "Bus_Branch":"Calbayog",
         "Bus_Route":"Allen",
         "Bus_Dep_Time":"9:30 AM",
         "Bus_Arriv_Time":"11:30 AM",
         "Bus_Driver":"Arnel Ignacio",
         "Bus_Contact":"09123456789",
         "Bus_DateAdded":"2021-08-07"
      }
   ]
}{
   "bus":[
      {
         "Bus_Plate_Number":"30",
         "Bus_Class":"Class 3 Unit",
         "Bus_Branch":"Calbayog",
         "Bus_Route":"Allen",
         "Bus_Dep_Time":"9:30 AM",
         "Bus_Arriv_Time":"11:30 AM",
         "Bus_Driver":"Arnel Ignacio",
         "Bus_Contact":"09123456789",
         "Bus_DateAdded":"2021-08-07"
      },
      {
         "Bus_Plate_Number":"35",
         "Bus_Class":"Class 3 Unit",
         "Bus_Branch":"Calbayog",
         "Bus_Route":"Allen",
         "Bus_Dep_Time":"9:30 AM",
         "Bus_Arriv_Time":"11:30 AM",
         "Bus_Driver":"Efren Catalan",
         "Bus_Contact":"09123456789",
         "Bus_DateAdded":"2021-08-07"
      }
   ]
}

This is not a valid json

2 Likes

you need to make some changes in your php code for generating valid json.

1 Like

I already warned you about thisā€¦
Iā€™ve already shown you the topic about JSONā€¦
Showed the link to test JSONā€¦

But it seems that the users here on the forum want to solve it in a few minutesā€¦

4 Likes

Sorry, the app that Iā€™m generating right now is part of my thesis thatā€™s why Iā€™m really eager to solve the problem quickly. Iā€™m currently adjusting the php file right now. This JSON is really new to me thatā€™s why I always got this error since last week.

(post deleted)

Already Rogerio shared a site . Please make use of it and correct your json

What he needs is to adjust the php script that generates the JSON.

2 Likes

I already knew whatā€™s the valid json. The only problem is how I will correct it through php. This is my code:

$conn = new mysqli($host,$username,$password,$dbname);
$data = mysqli_query($conn, "SELECT * FROM bus WHERE Bus_Dep_Time='9:30 AM' AND Bus_Branch='Calbayog'");
$array = array();
while ($result=mysqli_fetch_assoc($data))
{
    $array['bus'][]=$result;
    echo json_encode($array);
}

I keep adjusting the $array[ā€˜busā€™]=$result; but I always got the wrong json

I got it, i got itā€¦

:point_down:

From search in GOOGLE ā€¦

1 Like

It made some change. try it

$conn = new mysqli($host,$username,$password,$dbname);
$data = mysqli_query($conn, "SELECT * FROM bus WHERE Bus_Dep_Time='9:30 AM' AND Bus_Branch='Calbayog'");
$array = array();
while ($result=mysqli_fetch_assoc($data))
{
    $array[]['bus'][]=$result;
}
echo json_encode($array);
3 Likes