解码多个json对象php

I have this jsone that I need to convert in three different objects. in some php. I know that i have to use json_decode but I only decode the first object , the others 2 object don't.

{
"recorrido":[
{
"lon":"-60.67216873168769",
"lat":"-32.9230105876913",
"date":"13/10/24-12:22:32",
"globaltime":"00:09",
"globalkm":0.0,
"speed":2.11,
"altitude":-32.9230105876913,
"groupId3":0,
"id":1,
"color":0,
"auxInt":0,
"groupId2":0,
"provider":1,
"groupId1":0,
"workoutid":1
},
{
"lon":"-60.67216873168769",
"lat":"-32.9230105876913",
"date":"13/10/24-12:22:35",
"globaltime":"00:12",
"globalkm":0.0,
"speed":2.11,
"altitude":-32.9230105876913,
"groupId3":0,
"id":2,
"color":0,
"auxInt":0,
"groupId2":0,
"provider":1,
"groupId1":0,
"workoutid":1
}
],
"user":{
"asunto":"",
"userId":1
},
"Itemout":{
"uploaded":"false",
"isSelected":false,
"id":1,
}
}

what do you sugest? the script must be in php. the object "recorrido" is a multiple array object.

wthout testing it, try somrting like this:

$tempArray = (array)$recorrido; // or how you cal your json object
foreach ($tempArray as $tempJson)
{
$myArray = json_decode($tempJson);
print_r($myArray);
}
  1. You can use hardcode method if you have static json structure:

Show below

$result = json_decode($json);
$recorrido = $result->recorrido;
// And so on

In another way there is a workaround with arrays.

list($arr1, $arr2, $arr3) = json_decode($json, true);

This solution will make you three arrays of data from json.