how do I convert text to jsonB

后端 未结 3 1288
温柔的废话
温柔的废话 2021-02-13 03:38

What is the proper way to convert any text (or varchar) to jsonB type in Postgres (version 9.6) ?

For example, here I am using two methods and I am getting

3条回答
  •  花落未央
    2021-02-13 04:08

    If your text is just a json format text, you could just explicitly cast it to json/jsonb like this:

    select '{"a":"b"}'::jsonb

提交回复
热议问题