return jsonb without field label

Started by john.tigeralmost 11 years ago2 messagesgeneral
Jump to latest
#1john.tiger
john.tigernassau@gmail.com

have tables with : create table mydocs (id serial primary key, data jsonb)

when I do a select data from mydocs it comes back as {data: {my jsonb
fields}} which then gets passed into a template - don't want to have to
keep using <%= article.data.name %> instead of just data.name

probably easy but can't find out how - any suggestions?

ps: using new pg very lite orm library massive.js (npm massive) - easy
to run direct sql commands - very nice.

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: john.tiger (#1)
Re: return jsonb without field label

On 07/03/2015 06:28 PM, john.tiger wrote:

have tables with : create table mydocs (id serial primary key, data jsonb)

when I do a select data from mydocs it comes back as {data: {my jsonb
fields}} which then gets passed into a template - don't want to have to
keep using <%= article.data.name %> instead of just data.name

Can you show us your SELECT?

probably easy but can't find out how - any suggestions?

ps: using new pg very lite orm library massive.js (npm massive) - easy
to run direct sql commands - very nice.

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general