You put asc
in the fieldname. There’s no key named value asc
in the json, so data ->> 'value asc'
will always return NULL
.
You actually want:
select * from table ORDER BY data->>'value' ASC
to match the json, possibly even:
select *
from table
WHERE data ->> 'name' = 'stuff'
ORDER BY data->>'value' ASC