lets say i have a table in PostgreSQL with the following columns:
CREATE TABLE sample
(
id int,
jsonb jsonb,
date date
)
and i inserted this two rows:
INSERT INTO sample
(id,jsonb,date)
VALUES
(1, '{"a":"a","b":"b"}', '2014/01/06'),
(2, '{"a":"a","b":"b"}', '2014/01/06')
i want to convert the above rows into this(doing a select in PostgreSQL):
1,"a","b",'2014/01/06'
2,"a","b",'2014/01/06'
to call in php json_encode(rows from sample)
and get something like this:
[{"id":1,"a":"a","b":"b","date":"2014/01/06"},
{"id":2,"a":"a","b":"b","date":"2014/01/06"}]
but now if i call in php json_encode(rows from sample)
i get this:
[{"id":1,"jsonb":"{"a":"a","b":"b"}","date":"2014/01/06"},
{"id":2,"jsonb":"{"a":"a","b":"b"}","date":"2014/01/06"}]
hope someone can help me to handle that, thanks to everyone