Re: JSON NULLs
От | Yeb Havinga |
---|---|
Тема | Re: JSON NULLs |
Дата | |
Msg-id | 5118AA09.6000104@gmail.com обсуждение исходный текст |
Ответ на | Re: JSON NULLs (Andrew Dunstan <andrew@dunslane.net>) |
Ответы |
Re: JSON NULLs
|
Список | pgsql-hackers |
On 2013-02-10 16:03, Andrew Dunstan wrote: > On 02/10/2013 05:43 AM, Yeb Havinga wrote: >> 3. I was wondering how to access the first author from this json >> snippet: >> >> { >> "id": "QZr82w_eSi8C", >> "etag": "KZ+JsrkCdqw", >> "volumeInfo": { >> "title": "Heads Up Software Construction", >> "authors": [ >> "Dan Malone", >> "Dave Riles" >> ], >> >> > > try: > > json_get_path_as_text(document, 'volumeInfo', 'authors', '0') > > > There are other ways to spell this, too: > > json_get_path_as_text(document, variadic > '{volumeInfo,authors,0}'::text[]) > > > or > > document->>'{volumeInfo,authors,0}'::text[] That works very nice, thanks! > > I'm actually wondering if we should use different operator names for > the get_path*op functions so we wouldn't need to type qualify the path > argument. Maybe ?> and ?>> although I'm reluctant to use ? in an > operator given the recent JDBC discussion. Or perhaps #> and #>>. different operator name: +1. thanks Yeb
В списке pgsql-hackers по дате отправления: