JSON as core type in PostgreSQL 9.2

It looks like PostgreSQL 9.2 will get a JSON core type. Additionally, there will be functions to produce JSON data from database queries:

  • query_to_json()
  • array_to_json()
  • row_to_json()

Here is a simple example that uses the new query_to_json function:

SELECT query_to_json('select user_name as username, role_name as role from USER',false);

This query will produce JSON data:


This could be very useful for web applications that use a lot of JSON data to communicate between the frontend and backend.

Short URL for this post: https://blog.oio.de/UMbQ2
This entry was posted in Java Persistence and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *