2010/1/4 David E. Wheeler <[email protected]>:
> On Jan 3, 2010, at 4:18 PM, Hitoshi Harada wrote:
>
>> That sounds good and seems possible, as far as operator returns JSON
>> always. Perhaps every JSON fetching returns JSON even if the result
>> would be a number. You can cast it.
>>
>> % SELECT ('{"foo":{"bar":["a","b","c"]}}' -> '["foo"][1]')::text;
>> 1
>> -----
>> b
>
> No, because 'b' isn't valid JSON. So if we want an interface that returns
> scalars, they can't be JSON.
AFAIK string value can be parsed as JSON. At least my local v8 shell answers:
> JSON.stringify({"foo": {"bar": ["a", "b", "c"]}})
{"foo":{"bar":["a","b","c"]}}
> JSON.stringify("b")
"b"
Regards,
--
Hitoshi Harada
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers