You should not go via JSON or by associative arrays. Theoretically associative arrays do not guarantee that the order will be preserved.
This approach will only be useful if you can assume a standard order of fieldnames for each object.
Create a standard list of fieldnames that will be used when sending and receiving.
$objectsTypes = array('user','task')
$fieldsUser = array('firstname','lastname','age');
Then send the data in the correct order. Example using GET (POST could also work the same way):
?data[0][0]=Maxwell&data[0][1]=Smart&data[0][2]=35&data[1]=AnswerShoePhone
When processing the data you know which position to expect each variable. You could hard code the positions, or detect them dynamically.
echo $_GET['data'][0][0];//Maxwell
echo $_GET['data'][0][1];//Smart
echo $_GET['data'][1];//AnswerShoePhone
$indexOfUser = array_search('user',$objectsTypes);
$indexOfLastname = array_search('lastname',$fieldsUser);
echo $_GET['data'][ $indexOfUser ][ $indexOfLastname ];//Smart
If you want to support a collection of objects (e.g. multiple users) you can nest everything one level deeper. e.g.
?data[0][0][0]=Maxwell
&data[0][0][1]=Smart
&data[0][1][0]=Agent
&data[0][1][1]=99
$users = $_GET['data'][ $indexOfUser ]