友情链接:.NET项目开发者博客

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]]')

posted @ 2014-03-17 17:54  千年老妖  Views(11144)  Comments(0Edit  收藏  举报
友情链接:.NET项目开发者博客