UPDATED v.2
I changed the query to reflect the changes in the LEFT JOIN order, as well as show the object { ptitle, array( null ) }situation - the data you need is in the columnnew_col :
select
p.title as ptitle,
CONCAT('object { ', p.title, ', array( ', IFNULL(GROUP_CONCAT(CONCAT('array(', e.id, ' | ', e.title, ' | ', e.source, ' | ', e.etc, ')') SEPARATOR ', '), 'null'), ' ) }') AS new_col
FROM
table1 AS p
LEFT JOIN table2 AS e
ON p.id = e.table1_id
where
p.id = 1
GROUP BY
p.title
, new_col - , , , , .
, , , , , - examam wordpress api - 100%.
user2941651