Postgresql操作json格式数据

1.select array_to_json(‘{{1,5},{99,100}}’::int[])

2.select row_to_json(row(1,’foo’))

3.select to_json(‘Fred said “Hi”‘::text)

4.select json_array_length(‘[1,2,3,{“f1″:1,”f2”:[5,6]},4]’)


5.select * from json_each(‘{“a”:”foo”,”b”:”bear”}’)

6.select * from json_each_text(‘{“a”:”foo”,”b”:”bar”}’)

7.select json_extract_path(‘{“f2”:{“f3″:1},”f4”:{“f5″:99,”f6″:”foo”},”f7″:66}’,’f7′)

8.select json_object_keys(‘{“f1″:”abc”,”f2″:{“f3″:”a”,”f4″:”b”}}’)

9.select * from     json_populate_recordset(null::t_row,'[{“a”:1,”b”:2},{“a”:3,”b”:4}]’)

10.select json_array_elements(‘[1,true,[2,false]]’)

    原文作者:PostgreSQL
    原文地址: https://www.cnblogs.com/hanwenhuazuibang/p/3605604.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞