Is it possible to do this with built functionality?
I miss the cast function for json scalar string value to string.
#>>'{}'
It is working. Thank you. But this syntax is a little bit scary. Maybe we can introduce some functions for this case. Until to pg 14 this functionality was not necessary, but now it can be nice to have it.
DO $$ DECLARE v jsonb; BEGIN -- hodnota musi byt validni json v['a'] = '"Ahoj"'; RAISE NOTICE '%', v['a'] #>> '{}'; END; $$; NOTICE: Ahoj DO
Some ideas about the name of this function?
CREATE OR REPLACE FUNCTION jsonscalar_to_text(jsonb)