I have tried and facing issue while reading json column in PostgreSQL table. below is the table description.
task=# \d quots
Table "public.quots"
Column | Type | Modifiers
------------------+---------+-----------
items | json |
id | integer |
supplier_id | integer |
Here is the data in table.
select items from quots limit 1;
items
-----------------------------------------------------------------------------------------------------------------------------------
[{"item1":[{"id":5,"name":"Item Name","unitPrice":{"original":10.0,"converted":10.0}}],"item2":{"id":75,"name":"Name"},"id":23653}]
Now when I try to query and get item1, it return empty.
select items->'item1' from quots limit 1;
?column?
----------
(1 row)
Any Clue?
PostgreSQL 9.4.4 PSQL 9.4.4