Why can't NULL be converted to JSON's null in postgreSQL?

前端 未结 2 1075
半阙折子戏
半阙折子戏 2021-01-13 08:51

I can perform

SELECT to_json(1)
SELECT to_json(1.4)
SELECT to_json(\'this is a nice json text\')
SELECT to_json(\'{\"become\":\"json\"}\')
SELECT to_json(\'n         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 09:00

    Pavel Stehule's answer is great, and has led me to a simpler solution:

    SELECT 'null'::json;
    

提交回复
热议问题