Deciding when to use JSON data types
This will be an unusual recipe, being more of a list of best practices and tips, based on experience.
Getting ready
If you are thinking of using a JSON data type, then you already know what JSON is, and you probably have in mind several examples of JSON values.
However, if for some reason you want to run this recipe without knowing what JSON is, you can get a very good idea by visiting its official website (https://www.json.org/), which has been translated into many languages.
There is nothing else you need to do on PostgreSQL because the JSON data types and operators are already built in by default.
How to do it…
When deciding on a database model, you have two opposite approaches.
In the relational approach, the database schema is normalized, by ensuring that each piece of information has its own separate column. The column metadata defines some information on what restrictions apply:
- Whether that...