Re: Building JSON objects

From: Eli Murray <ejmurra2(at)illinimedia(dot)com>
To: Jan de Visser <jan(at)de-visser(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Building JSON objects
Date: 2015-03-27 19:30:13
Message-ID: CAHReO_u2xZ5+Get5VnjrELpw6QmRaPApSyfG3WtyfkH2M6npXg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks to you all for the replies. Adrian, your solution is working for me
without errors but it's not actually inserting anything. I'll keep fiddling
with it and see if I can get what I want but I'm confident now that I'm on
the right path. As a backup, I did what I wanted to in Javascript and wrote
it to a file that I serve from my server when users request it. Thanks
again!

On Fri, Mar 27, 2015 at 1:49 PM, Jan de Visser <jan(at)de-visser(dot)net> wrote:

> On March 27, 2015 11:38:42 AM David G. Johnston wrote:
> > On Fri, Mar 27, 2015 at 11:31 AM, Jan de Visser <jan(at)de-visser(dot)net>
> wrote:
> > > On March 27, 2015 01:12:52 PM Eli Murray wrote:
> > > > ERROR: syntax error at or near "json_build_object"
> > > > LINE 1: insert into json(data) json_build_object(SELECT DISTINCT
> dep...
> > >
> > > You may want to review the syntax of the INSERT command, i.e. this
> doesn't
> > > have anything to do with JSON:
> > >
> > > INSERT INTO foo ( bar, baz, quux, froz ) VALUES (NULL, 12, 'box',
> now())
> >
> > ​or..
> >
> > INSERT INTO json(data) SELECT json_build_object(SELECT DISTINCT dep...)
> >
> > ​David J.
>
> Serves me right for bringing the snark without properly reading the OP :-)
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

--
Senior Web Developer at The Daily Illini
ejmurra2(at)illinimedia(dot)com
(815) 985-8760

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2015-03-27 20:07:50 Re: Building JSON objects
Previous Message Jerry Sievers 2015-03-27 18:53:09 Re: [GENERAL] check data for datatype