eliminate double quotes from a json field in a selective manner in postgresql

You can use jsonb_set() to turn change the datatype of the value of attribyte parameter1:

update t_test_result
set test_json = jsonb_set(
    test_json, 
    '{parameter1}', 
    to_jsonb((test_json ->> 'parameter1')::numeric)
)
where test_json ? 'parameter1'

Demo on DB Fiddle

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top