Skip to content
Advertisement

Php json_encode array and object array

I need to create a json with this format:

JavaScript

in entries, a $header who check the user token(not use for my problem) $table the table returned from PDO::FETCHASSOC from sql SELECT request My php code:

JavaScript

I have this result

JavaScript

I think the Json format eror is in the array_merge function. What add array function can I use to not remove the Box object

Advertisement

Answer

Try this one

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement