Unpacking scalar JSON values - Mailing list pgsql-hackers

From Daniel Farina
Subject Unpacking scalar JSON values
Date
Msg-id CACN56+P8irXUQv168x8-2Sqk4T=4CruyZ+wKohAAnz41rw+z7A@mail.gmail.com
Whole thread Raw
Responses Re: Unpacking scalar JSON values  (Hannu Krosing <hannu@2ndQuadrant.com>)
List pgsql-hackers
Per report of Armin Ronacher, it's not clear how to take a scalar JSON
string and unquote it into a regular Postgres "text" value, given what
I can see here:
http://www.postgresql.org/docs/9.3/static/functions-json.html

Example:

SELECT '"a json string"'::json;

(Although this some problem could play out with other scalar JSON types):

SELECT '4'::json;
SELECT '2.0'::json;

This use cases arises from some of the extant unpacking operations,
such as json_array_elements.  It's not that strange to have a value
something something like this in a JSON:

'{"tags": ["a \" string", "b", "c"]}'

Thoughts?



pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: pgbench progress report improvements
Next
From: Hannu Krosing
Date:
Subject: Re: Unpacking scalar JSON values