Postgresql操作json格式数据

时间:2021-10-08 15:48:02

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

Postgresql操作json格式数据

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

Postgresql操作json格式数据

3.select to_json('Fred said "Hi"'::text)

Postgresql操作json格式数据

4.select json_array_length('[1,2,3,{"f1":1,"f2":[5,6]},4]')

Postgresql操作json格式数据5.select * from json_each('{"a":"foo","b":"bear"}')

Postgresql操作json格式数据

6.select * from json_each_text('{"a":"foo","b":"bar"}')

Postgresql操作json格式数据

7.select json_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"},"f7":66}','f7')
Postgresql操作json格式数据8.select json_object_keys('{"f1":"abc","f2":{"f3":"a","f4":"b"}}')

Postgresql操作json格式数据

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操作json格式数据