Working with JSON and JSONB
After diving headlong into recursions, we want to focus on the last topic of this chapter: JSON. In recent years, JSON has become more and more important. For web developers, JSON has pretty much replaced other things, such as SOAP, plain XML, and custom-made APIs. These days, JSON is the de facto standard to exchange data on the net. Therefore, the PostgreSQL community has acted and implemented extensive JSON support into PostgreSQL.
In this section, you will be introduced to the basic concepts and we will show some basic operations that you can do using JSON documents. Keep in mind that JSON in PostgreSQL has become really powerful and JSON support is growing. Therefore, comprehensive coverage of the topic has become close to impossible. You have to keep that in mind when going through this chapter. There is more out there, and it is growing at a rapid pace.
Two data types have been added: json
and jsonb
. While the json
data type validates the JSON...